Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ ">>" and "<<" IO in C#?

Tags:

c++

c#

io

Is there a C# library that provides the functionality of ">>" and "<<" for IO in C++? It was really convenient for console apps. Granted not a lot of console apps are in C#, but some of us use it for them.

I know about Console.Read[Line]|Write[Line] and Streams|FileStream|StreamReader|StreamWriter thats not part of the question.

I dont think im specific enough

int a,b;
cin >> a >> b;

IS AMAZING!!

string input = Console.ReadLine();
string[] data = input.split( ' ' );
a = Convert.ToInt32( data[0] );
b = Convert.ToInt32( data[1] );

... long winded enough? Plus there are other reasons why the C# solution is worse. I must get the entire line or make my own buffer for it. If the line im working on is IDK say the 1000 line of Bells Triangle, I waste so much time reading everything at one time.

EDIT: GAR!!!

OK THE PROBLEM!!!

Using IntX to do HUGE number like the .net 4.0 BigInteger to produce the bell triangle. If you know the bell triangle it gets freaking huge very very quickly. The whole point of this question is that I need to deal with each number individually. If you read an entire line, you could easily hit Gigs of data. This is kinda the same as digits of Pi. For Example 42pow1048576 is 1.6 MB! I don't have time nor memory to read all the numbers as one string then pick the one I want

like image 969
David Stocking Avatar asked Feb 28 '23 12:02

David Stocking


1 Answers

No, and I wouldn't. C# != C++

You should try your best to stick with the language convention of whatever language you are working in.

like image 193
Robert Greiner Avatar answered Mar 08 '23 07:03

Robert Greiner