public void Success(string data) { ResultRoot = JsonMapper.ToObject(data); IDictionary mapper = ResultRoot as IDictionary; if (mapper.Contains(FailedKeyField) && (ResultRoot.Int(FailedKeyField) != SuccessKeyValue)) { string errorCodeValue = ResultRoot[FailedKeyField].ToString(); int errorCode = int.Parse(errorCodeValue); Failed?.Invoke(errorCode); } else { if (mapper.Contains(DataKeyField)) { ResultData = ResultRoot[DataKeyField]; } else { ResultData = ResultRoot; } mDataMapper = ResultData as IDictionary; OnSuccessed?.Invoke(this); SuccessForCustom?.Invoke(data); } ResultRoot?.Clear(); ResultData?.Clear(); ResultRoot = default; ResultData = default; OnSuccessed = default; SuccessForCustom = default; Failed = default; Error = default; }