Click here to Skip to main content
15,565,474 members
Home / Discussions / C#
   

C#

 
AnswerRe: Multi-threaded debugging Pin
Randor 11-Dec-22 9:46
professional Randor 11-Dec-22 9:46 
GeneralRe: Multi-threaded debugging Pin
Richard Andrew x6411-Dec-22 15:36
professionalRichard Andrew x6411-Dec-22 15:36 
PraiseRe: Multi-threaded debugging Pin
Randor 11-Dec-22 16:50
professional Randor 11-Dec-22 16:50 
QuestionRegarding a line in code Pin
vineeth s5-Dec-22 8:06
vineeth s5-Dec-22 8:06 
AnswerRe: Regarding a line in code Pin
Richard MacCutchan5-Dec-22 9:02
mveRichard MacCutchan5-Dec-22 9:02 
AnswerRe: Regarding a line in code Pin
OriginalGriff5-Dec-22 9:22
mvaOriginalGriff5-Dec-22 9:22 
AnswerRe: Regarding a line in code Pin
BillWoodruff6-Dec-22 1:51
professionalBillWoodruff6-Dec-22 1:51 
GeneralRe: Regarding a line in code Pin
Richard Deeming6-Dec-22 2:08
mveRichard Deeming6-Dec-22 2:08 
BillWoodruff wrote:
var mystudent = new Student();
On a similar note, from C# 9 onwards, the compiler can often infer the type on the right-hand side from the declaration:
Target-typed new expressions - C# 9.0 draft specifications | Microsoft Learn[^]
C#
Student student = new();
That works in more places than var (eg: fields), and can reduce the amount of typing even further; for example, compare:
C#
var students = new List<Student>
{
    new Student { ... },
    new Student { ... },
};
to:
C#
List<Student> students = new()
{
    new() { ... },
    new() { ... },
};

However, I suspect the use of var and target-typed new might currently be a few lessons further down the line for the OP. Smile | :)



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Regarding a line in code Pin
BillWoodruff6-Dec-22 2:29
professionalBillWoodruff6-Dec-22 2:29 
GeneralRe: Regarding a line in code Pin
Richard MacCutchan6-Dec-22 2:34
mveRichard MacCutchan6-Dec-22 2:34 
GeneralRe: Regarding a line in code Pin
BillWoodruff6-Dec-22 2:43
professionalBillWoodruff6-Dec-22 2:43 
GeneralRe: Regarding a line in code Pin
Richard MacCutchan6-Dec-22 3:03
mveRichard MacCutchan6-Dec-22 3:03 
QuestionMessage Closed Pin
29-Nov-22 1:17
zystein29-Nov-22 1:17 
AnswerRe: A Problem about Collections Pin
Richard MacCutchan29-Nov-22 1:50
mveRichard MacCutchan29-Nov-22 1:50 
AnswerRe: A Problem about Collections Pin
OriginalGriff29-Nov-22 2:47
mvaOriginalGriff29-Nov-22 2:47 
QuestionSimple Broadcast Message on Local Host Pin
CodaNV28-Nov-22 22:49
CodaNV28-Nov-22 22:49 
AnswerRe: Simple Broadcast Message on Local Host Pin
OriginalGriff29-Nov-22 0:04
mvaOriginalGriff29-Nov-22 0:04 
GeneralRe: Simple Broadcast Message on Local Host Pin
CodaNV29-Nov-22 0:34
CodaNV29-Nov-22 0:34 
GeneralRe: Simple Broadcast Message on Local Host Pin
jschell29-Nov-22 7:27
jschell29-Nov-22 7:27 
AnswerRe: Simple Broadcast Message on Local Host Pin
Richard Deeming29-Nov-22 0:09
mveRichard Deeming29-Nov-22 0:09 
GeneralRe: Simple Broadcast Message on Local Host Pin
CodaNV29-Nov-22 0:37
CodaNV29-Nov-22 0:37 
AnswerRe: Simple Broadcast Message on Local Host Pin
Gerry Schmitz1-Dec-22 6:27
mveGerry Schmitz1-Dec-22 6:27 
AnswerRe: Simple Broadcast Message on Local Host Pin
CodaNV11-Dec-22 17:09
CodaNV11-Dec-22 17:09 
QuestionMy winform resize when i open an OleDbConnection Pin
Le@rner27-Nov-22 19:42
Le@rner27-Nov-22 19:42 
AnswerRe: My winform resize when i open an OleDbConnection Pin
Pete O'Hanlon27-Nov-22 22:30
mvaPete O'Hanlon27-Nov-22 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.