C# Tips Flashcards

(10 cards)

1
Q

What shortcup enables to add the right library at the top (using)

A

Ctrl+ dot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Shortcut for constructor

A

Ctor tabtab

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Shortcut to add property

A

Prop tabtab

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to see in real time the changes in a text file?

A

Use notepad+ -> view -> monitoring

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

New instance of a class and set parameter right away

A

Person person= new Person{FirstName=“John”, LastName=“Doe”}

//no parenths

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Debug F shortcut

A

F5: go to the next breakpoint
F10: go to the next line of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Winform default button

A

The main form got acceptbutton and cancelbutton property for entrer and cancel key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

2 ways to force a conversion to int (with exception)

A

String s =“123”;
Int i=int.Parse(s);

Or

Int i=Convert.ToInt32(s);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Convert into int, deal with exception

A

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); …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Shortcut to add full property

A

Prop full tabtab

How well did you know this?
1
Not at all
2
3
4
5
Perfectly