Home >Backend Development >C++ >What Does the `=>` Operator Do in C# Properties and Methods?
`` `` `` `` `` `` `` " /> <code class=" language-csharp>public int MaxHealth => Memory[Address].IsValid ? Memory[Address].Read<int>(Offs.Life.MaxHp) : 0; </p> <p> If is true, return </p> <ul> <li> If is false, return 0 <code>Memory[Address].IsValid</code> <code>Memory[Address].Read<int>(Offs.Life.MaxHp)</code> </li> The difference between the initialization of the field <li> <code>Memory[Address].IsValid</code> </li> Unlike the main attributes of the expression, the field declaration with the initialization device only evaluates its expression only during the type instantiated period. For example: </ul> <p> <strong> This code shows a field, which is determined by the three yuan condition operators. The operator is evaluated only when type instantiation. </strong> </p> Other Member of the main expression <p> </p> <pre class="brush:php;toolbar:false"><code class="language-csharp">public int MaxHealth = x ? y : z;</code> The main members of the expression are limited to attributes. They can also be used for:
Index
Method The operator Construction function (added in C# 7.0)
Terminal (added in C# 7.0)
The above is the detailed content of What Does the `=>` Operator Do in C# Properties and Methods?. For more information, please follow other related articles on the PHP Chinese website!