Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- interface I
- {
- int X { get; set; }
- void Calculate();
- }
- struct S : I
- {
- public int X { get; set; }
- public void Calculate() { X += 1; }
- }
- static void Main(string[] args) {
- I s = new S();
- Console.WriteLine(s.X); // s.X == 0
- Work(ref s);
- Console.WriteLine(s.X); // s.X == 0, но надо сделать, чтобы было s.X == 1!!!
- Console.ReadKey();
- }
- static void Work(ref I i) { i.Calculate(); }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement