What will actually happens with references when we create an instance of the class in that same class like this:
public class Class1
{
public Class1 instatnce;
}
And how it will look references when we'll try to get access to instance.
What will actually happens with references when we create an instance of the class in that same class like this:
public class Class1
{
public Class1 instatnce;
}
And how it will look references when we'll try to get access to instance.
Its not a problem. For example:
public class Class1
{
public Class1 Instance {get; set;}
}
public class Class2
{
public void Test()
{
Class1 class1 = new Class1();
var nestedInstance = class1.Instance;
}
}
Please read about singleton pattern: https://msdn.microsoft.com/en-us/library/ff650316.aspx This let you to understand this case