public void ResponseHandler<T>( string responseContent, ref Result<T> result)
where T : IServiceModel
{
var respModel = responseContent.FromJson<OrderResponse>();
if (respModel.Status.Equals(_innerConfig.SuccessTradeStatus, StringComparison.OrdinalIgnoreCase))
{
result.IsSuccess = true;
result.Data.TradeNo = respModel.Transaction_id;// CAN NOT resolve symbol TradeNo
}
...
}
public class Result<T> : Result
{
public T Data { get; set; }
}
public class MyModel:IServiceModel
{
public string TradeNo { get; set; }
}
public interface IServiceModel
{
}
usage : ServiceProvider.ResponseHandler<MyModel>(responseContent, ref result);
The problem is I can not get the property TradeNo
,
I found another thread: Generic functions and ref returns in C# 7.0
But not sure it is the same problem with my code.
Any suggestions?Thanks. :)