Public class ClassA
{
Private int state=1;
Public int State=& gt; state;
}
Could you please tell me where the=& gt; What the arrow, I checked the lambda is not clear, so ask everyone! Thank you for the
CodePudding user response:
The equivalent ofPublic int State {get {return State; }}
CodePudding user response:
You can remember, this is "read-only" simplify writing,CodePudding user response:
Couldn't help give you a suggestion, a novice as far as possible to avoid seeing these obscure things,All kinds of simplified wording, collectively referred to as: syntactic sugar,
The purpose is to simplify the code, hidden away again and again the format of the symbol, for starters, time and effort to understand the words, not just as simple, remember that this is a "weird" writing, don't have to dig in, some syntactic sugar for beginners is not friendly, but reduces the readability,
CodePudding user response:
Simplify the properties of the said method, equivalent to return the state;CodePudding user response:
Ok thank you, everybody! Educated!CodePudding user response:
Public int State=& gt; StateAccording to the input state, the implementation of the state
Or the input and output are the State;
This is called Lambda expressions