Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
主題として
public String imie, nazwisko{get; private set;}
imie両方とnazwisko同じ行にget/setルールを適用します
imie
nazwisko
1つのステートメントで複数のフィールドを宣言する場合は、次のことができます。
public string imie, nazwisko, whatever;
あなたが投稿したのは、プロパティで同じことをしようとする試みですが、これは不可能です(共有ゲッター/セッター宣言ではできません)。
ただし、もちろん、これらは1行にまとめることができます。
public string imie{get; private set;} public string nazwisko{get; private set;}
MSDNのフィールドとプロパティについて読むことをお勧めします。