C# Tips Flashcards
(10 cards)
What shortcup enables to add the right library at the top (using)
Ctrl+ dot
Shortcut for constructor
Ctor tabtab
Shortcut to add property
Prop tabtab
How to see in real time the changes in a text file?
Use notepad+ -> view -> monitoring
New instance of a class and set parameter right away
Person person= new Person{FirstName=“John”, LastName=“Doe”}
//no parenths
Debug F shortcut
F5: go to the next breakpoint
F10: go to the next line of code
Winform default button
The main form got acceptbutton and cancelbutton property for entrer and cancel key
2 ways to force a conversion to int (with exception)
String s =“123”;
Int i=int.Parse(s);
Or
Int i=Convert.ToInt32(s);
Convert into int, deal with exception
String s=“123456”;
Int i
Bool isParsable=int32.TryParse(s, out i)
If (isParsable)
Console.Writeline(i);
Else
Console.WriteLine(“cannot be parses”);
Shortversion:
If (Int32.TryParse(s,out int i))
Console.WriteLine(i); …
Shortcut to add full property
Prop full tabtab