c# Flashcards
c#: To create a class, type
class ClassName {
}
c#: To write a method that doesnt return anything, type
static void MethodName()
{
}
c#: the first mandatory method called in any script is
static void Main()
{
}
c#: To create a comment, type
//
c#: .NET is
the library ecosystem that c# can import and use
c#: You must end all lines with a
;
c#: A common compiler for c# is
mono
c#: You can compile c# scripts using mono by typing
mcs ScriptName.cs
c#: You run c# scripts on mac or linux, type
mono ScriptName.exe
c#: To initialize a string variable, type
string varName = “string”;
c#: To write to the console, type
System.Console.Write(“string”);
System.Console.WriteLine(“string”);
c#: To get input into the console, type
System.Console.ReadLine();
c#: Methods are
capitalized
c#: Method calls in c# require you to
call the namespace, then the class, then the method
NameSpaceName.ClassName.MethodName();
c#: To set the namespace, type
namespace NameSpaceName
{
}
c#: To avoid having to write the namespace, type
using NameSpaceName
note: No ;
c#: Namespaces can be named
NameSpaceName.NameSpaceName.NameSpaceName