Is it possible to reference a class within the same class... I mean in the following code, I have to get the attribute value from a saved file, that's what I want to return.
public class MyClass
{
private string attr1 = "atrribute 1";
public string Attr1
{
get
{
//In the line below, I have to reference the type of the class "MyClass"
if (MyFileStorage.ReadSharedData<MyClass>("filename.xml").prop1.Equals(String.Empty))
return attr1;
else
return MyFileStorage.ReadSharedData<MyClass>("filename.xml").prop1;
}
set
{
MyFileStorage.WriteSharedData("filename.xml", value);
}
}
private string attr2 = "atrribute 2";
public string Attr2
{
get
{
return attr2
}
set
{
attr2 = value;
}
}
}
USAGE
public static MyClass myClass;
Debug.WriteLine(myClass.Attr1); //output: attribute 1
myClass.Attr1 = "xyz";
Debug.WriteLine(myClass.Attr1); //output: xyz (should be able to read this value from the Storage file)
However, there's an Unknown error. It is not possible and the app is stuck!
Could anyone tell me how is it possible to read a property value from a storage file (which has MUTEX implemented) and it's a shared file among two projects and return.
ReadSharedData implementation: stackoverflow.com/questions/21596564/