0% found this document useful (0 votes)
25 views2 pages

C# Basics: Variables and File I/O

Uploaded by

tyreekbrasfield
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

C# Basics: Variables and File I/O

Uploaded by

tyreekbrasfield
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Crash Course in C#

cout = [Link]

alway add [Link](); anywhere

var - must have a value

object - everything is derived from this and data type can be changed
- it is considered a dynamic varible

decimal - data used for better percision over double


- usually used with money

[Link] - store input varibles

use [Link] with [Link] in brackets for varible input that is not a
string.

"_" - means default

Static - means that its existence in code is not bound to what it is contained in.

Array Ex.
datatype[] name = new datatype[size];

-------Read and Write files in C#------------

Dictionary<string, int> loadesSales = LoadSales(text file directory location)

//option 3 Implementation
string? inputted_cookie_name;
[Link]("Enter the name of the cookie:")';

inputted_cookie_name = [Link]():

if(inoutted)cookie_name ==null || inputted_cookie_name ==[Link]

static Dictionary<string,decimal> LoadSales(string


filename)

dictionary <string, int> loadedsales = dictionary<string,int>(); - What does this


do?
- seems like a vector.

streamReader sr = newStreamReader(filename);

string? line;

while((line = [Link]())!= null) - like getline in c++


string [] data = [Link](',');
string cookie_name = data[0];
int cookie_count = [Link](data[1]), // or convertint32
[Link](COOKIE_NAME; COOKIE_COUNT);
return loadSales;

You might also like