Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ObjectFun {
- class Player {
- public string PlayerName { get; set; }
- }
- struct PlayerStruct {
- public string PlayerName { get; set; }
- }
- class Program {
- static void Main() {
- var player = new Player {PlayerName = "Test1"};
- var player2 = new Player {PlayerName = player.PlayerName};
- player.PlayerName = "New Name";
- Console.WriteLine(player2.PlayerName);
- var player3 = new PlayerStruct { PlayerName = "Test1" };
- var player4 = new PlayerStruct {PlayerName = player.PlayerName};
- player3.PlayerName = "New Name";
- Console.WriteLine(player4.PlayerName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement