Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- struct Mutable
- {
- public Mutable(int x, int y)
- : this()
- {
- X = x;
- Y = y;
- }
- public void IncrementX() { X++; }
- public int X { get; private set; }
- public int Y { get; set; }
- }
- class A
- {
- public A() { Mutable = new Mutable(x: 5, y: 5); }
- public Mutable Mutable { get; private set; }
- }
- internal class Program
- {
- private static void Main(string[] args)
- {
- A a = new A();
- Console.WriteLine(a.Mutable.X);
- a.Mutable.IncrementX();
- Console.WriteLine(a.Mutable.X);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment