How to pass this by ref in C#?

后端 未结 5 1909
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 17:27

In a class (ClassA) of mine I want to create a related instance of another class (ClassB) providing it with a reference to the object who has initiated it\'s creation. So I\

5条回答
  •  青春惊慌失措
    2020-12-03 18:11

    Do you really need the ref keyword? All the types are basically passed by reference, so if you have ClassB take ClassA as constructor argument, just pass new ClassB(this), no need to use ref.

提交回复
热议问题