KenallChen KenallChen - 3 years ago 145
C# Question

c# confused with lambda expression in set property

I've read some code in setting property for a class like below

private int id;
public int ID {
get=>id;
set=>id=value;
}


and it works. But I'm totally confused by the lambda syntax.

I know that lambda expression would be
(input-parameters) => expression
.
how could it drop brackets in the left.

I've search the answer in google but not found. the likely answer would be that get&set should be equal to delegate, but I've no idea about this. Does someone has document about this?

Answer Source

It's about C# 6 & C# 7

Look at here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download