Created
June 24, 2015 11:26
-
-
Save xmfcx/f1e2e861d3bd301b3859 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 int Val2; | |
public int Val3; | |
public TheClass Old; | |
public void Remember() | |
{ | |
Old = new TheClass(); | |
Old.Val1 = Val1; | |
Old.Val2 = Val2; | |
Old.Val3 = Val3; | |
} | |
} | |
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