c# basic
csc <source.cs>: Compiles app
- F10: Step-Over
- F11: step-into
- F5: run w/ debug
- ctrl-F5: run w/out debug
Main()
point of entry, it'll look for Main() in any class. If more than 1 Main exists, it is error.
public static int Main(string[] args): for CLI arg
namespace
namespace X { ... }
Statements
int b = 2, c = 3;
do { } while (...);
for (;;;) { }
while () { }
foreach (string s in args) { x(s)}
continue: forgoes the remaining statement in loop & makes an early start on the next iteration.
break: breaks away from loop completely.
switch.. case
Must have break or goto statement to end each case. Can be String, int, bool, enum,
switch(var) {
case null:
goto default;
case ""King"":
break;
default:
break;
}
Comments
///: 3 slashes=XML formatted comment * <c>,<code>: code
- <example>: code example
- <exception>: exception desc
- <include>: include doc from another doc file
- <list>: insert lists
- <param>: method param
- <paramref>
- <remark>: adds description for member
- <returns>: return value
- <see>: cross-reference to another param
- <seealso>: see-also section in desc
- <summary>: summary of type/member
- <value>: describes property
To generate XML DOC, add ""/doc"" to csc:
csc /t:library /doc:Math.xml Math.cs Project(right click)->Properties->Build->XML Documentation File->(Enter filename)
- To generate HTML Page from this:
- Tools->Build Comment Web Pages...
Preprocessor
- #ifdef #define #endif
- But not #define MACRO <something ...>
- #warning #error
- #region #endregion : treat this as separate block, for editing
- //TODO: shows up in Tasks
- //UNDONE: Shows up in Tasks
- //HACK: Shows up in Tasks
