Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Account
- {
- public string UserName { get; private set; }
- public string Password { get; private set; }
- public Account(string UserName, string Password)
- {
- this.UserName = UserName;
- this.Password = Password;
- }
- }
- // main method in some other class
- public static Main(){
- Account account = new Account ("someUserName", "somePassword");
- Console.Writeln("my user name : " + account.UserName);
- Console.Writeln("my password : " + account.Password);
- // But the following is not valid :
- account.UserName = "someNewValue";
- account.Password = "someOtherPassword";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement