C
C#2y ago
Matt

❔ StreamWriter and StreamReading help

Hi, i'm currently working on a project which has a students name, student ID, and if they passed or failed and their percentage and I was just wondering how do I streamwrite and read it all as im still so confused.
10 Replies
Angius
Angius2y ago
Well, this error is obvious
Angius
Angius2y ago
And very easy to avoid if you use interpolation instead of concatenation The other two... We'd need to see what they say
Matt
MattOP2y ago
I might be dumb here but what is the difference, sorry this is my first big project i have ever had to do so kinda making errors left and right
Angius
Angius2y ago
$interpolation
MODiX
MODiX2y ago
String interpolation is the preferred way of building strings in C#. It is easier to read than concatenation. For example:
var foo = 1;
var bar = 2;
Console.WriteLine("foo is equal to: " + foo + " and bar is equal to: " + bar);
var foo = 1;
var bar = 2;
Console.WriteLine("foo is equal to: " + foo + " and bar is equal to: " + bar);
can be written as:
var foo = 1;
var bar = 2;
Console.WriteLine($"foo is equal to: {foo} and bar is equal to: {bar}");
var foo = 1;
var bar = 2;
Console.WriteLine($"foo is equal to: {foo} and bar is equal to: {bar}");
Angius
Angius2y ago
'Ere you go
Matt
MattOP2y ago
Cheers I didn’t even know about that bit the main error issue I was having was reading just cause it’s giving me a mare
ero
ero2y ago
female horse
Matt
MattOP2y ago
Sorry nightmare
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server