Home > Net > C # will structure used in reference to the class instance
C # will structure used in reference to the class instance
Time:12-08
Please everyone a great god, and now I have a structure body, want to call changes in reference to a class instance, but I learned right now, value types of data, to reference use only ref method, but this way not only can be used in a function? How can I put this reference to an instance of a class to use? For example: I have A struct A, an A new comes out, and then assign A value, and A class B, instance of A B, now want to have A reference to B, B as an instance of A global variable, how to do? I have tried to use the public b (ref A A) way to introduce, but this can only be quoted in the constructor of A, b
CodePudding user response:
For class B members of A static public static aa {get; set; }=new A ();
CodePudding user response:
No, this is exclusive of the class B, what I want is the external incoming A, only this one instance to B in general,