I have an strange comportement with my singleton class.
public class HttpCommunicator{
public const int TYPEJSON = 1;
private static HttpCommunicator;
private bool TypeIsInit = false;
public static HttpCommunicator Instance {
get{
if( instance == null ){
instance = new HttpCommunication();
}
return instance;
}
}
private HttpCommunicator(){}
public int RequestType {get {return RequestType;} set{ this.RequestType = value; TypeIsInit = true;}
}
And later in another class i call this
HttpComminicator.Instance.RequestType = HttpCommunicator.TYPEJSON;
My app get stuck/freeze and my debugger don't show me any error. But if I change the get;set; method for this attribut to:
public int GetRequestType(){
return RequestType;
}
public void SetRequestType(int value){
RequestType = value;
TypeIsInit = true;
}
everything works like a charm.
Anybody can explain me why I get this?