Hello every1 <3
Hopefully I can bother some with some q's... I apologize in advance if they are a tad easy or a tad too many (since I wanted to avoid making so many threads). Anyhow, thanks for any help on ANY questions! Just ignore a question if you don't feel like answering it, as I'm grateful for any feedback. Sorry for any incoherence as well; I did solve many things with Google, but I can't seem to find details on a few, sadly (although I'll keep trying). Much obliged!
1) In C++, system("pause") is used to pause programs (although I believe some would say this is bad practice but anyhow); so in C#, doesused for this role? Unfortunately, my manual doesn't really go over this basic fact.Code:Console.ReadLine();
2) is an extra Console.ReadLine(); needed for a block of if-else statements? (I don't see how else to system pause).
3) How else can I skip a line? Use an empty Console.WriteLine(); or Console.WriteLine("my text \n"); ?
4) Saw this in a textbook:Isnt the placeholder supposed to use braces, not parentheses?Code:Console.WriteLine("My name is (0)", myString);
5) Are custom (i.e. your created) namespaces necessary for simple programs?
6) Are Console.WriteLine(w.GetType()); or Char.IsLetter(yourChar) methods?
7) Does it matter that char.IsLetter(yourChar) uses a lower case c?
8) Is string.Format like ToString? Why not use writeline?
9) Saw this in a text book as well.Is isEqual missing a bool ? (I couldn't compile otherwise)Code:// Check for equality: isEqual = (a == b); Console.WriteLine("BTW, the equality is: {0}.", isEqual );
10) Is there an alternative toIs our input strictly regarded as strings, or char with casting?Code:string theNumber = Console.ReadLine();
11) After multiple using multiple sources, I can't seem to differentiate heap from stack. Any tips?
12) Finally, forWhat is going on here? I do recognize 0:x as a hexadecimal conversion, but I'm not sure what the Bitwise Operators are or what they're doing... (¬_¬")Code:// Hexadecimal: Console.WriteLine("0x{0:x}",0x15 | 0x4); // 0x15 Console.WriteLine("0x{0:x}",0x15 & 0x4); // 0x4 // Decimal: Console.WriteLine(21 | 4); // 21 Console.WriteLine(21 & 4); // 4
I apologize again, and I appreciate you taking the time to read this. Cheers!