Expression-bodied members in properties
Read OriginalThis technical article clarifies a key C# concept: the difference between a property with a getter initializer (`public int A { get; } = ...`) and an expression-bodied property (`public int B => ...`). It demonstrates that the initializer evaluates once at creation, while the expression-bodied member is evaluated on every access, using code examples and lowered IL to illustrate the behavior.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser