question

TZacks-2728 avatar image
0 Votes"
TZacks-2728 asked ·

C# not able to understand a code snippet

See this code
public override string EditorTypeName => CustomEditName;

what kind of code is it ?

is it any function declaration or property?

how to convert the above to .net 4.5 version compatible? thanks

dotnet-csharp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Viorel-1 avatar image
1 Vote"
Viorel-1 answered ·

how to convert the above to .net 4.5 version compatible?

Place the caret at this line, press <Ctrl+.> and select “Use block body for properties”.

If you do not have Visual Studio right now, it will transform it to:

 public override string EditorTypeName
 {
    get
    {
       return CustomEditName;
    }
 }

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Expression body definition has any advantages or is it a syntactic sugar ? when we write a function having multiple lines then can we use Expression body definition there. How to compose a multi line function with Expression body definition. please share a code snippet if possible. thanks

0 Votes 0 ·
SimpleSamples avatar image
0 Votes"
SimpleSamples answered ·

It is an Expression body definition, as in => operator.


· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Expression body definition has any advantages or is it a syntactic sugar ? when we write a function having multiple lines then can we use Expression body definition there. How to compose a multi line function with Expression body definition. please share a code snippet if possible. thanks

0 Votes 0 ·