TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C# Light Syntax

1 pointsby balakkalmost 14 years ago

1 comment

DanielStraightalmost 14 years ago
Auto-properties can be public read, private set. So really, it looks like:<p><pre><code> namespace MyCompany.MyProduct { public class Person { public Person(string name, int age) { Name = name; Age = age; } public string Name { get; private set; } public int Age { get; private set; } } } </code></pre> I suppose it's not <i>technically</i> immutable, but you can just refrain from setting anywhere else inside the class.
评论 #2688759 未加载