Created
June 24, 2015 10:55
-
-
Save xmfcx/cd64786a03bc76468f01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TheClass | |
{ | |
public int Val1; | |
public TheClass Old; | |
public void Remember() | |
{ | |
Old = (TheClass)MemberwiseClone(); | |
} | |
} | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
TheClass aClass = new TheClass(); | |
aClass.Val1 = 5; | |
aClass.Remember(); | |
aClass.Val1 = 10; | |
Console.WriteLine(aClass.Old.Val1); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment