/// <summary> /// 返回的Task(Of T)的T类型描述 /// </summary> /// <param name="dataType">数据类型</param> /// <exception cref="ArgumentNullException"></exception> public DataTypeDescriptor(Type dataType) { this.Type = dataType ?? throw new ArgumentNullException(nameof(dataType)); var taskType = typeof(ApiTask <>).MakeGenericType(dataType); this.ITaskFactory = Lambda.CreateNewFunc <ITask>(taskType); this.ITaskConstructor = taskType.GetConstructor(emptyTypes); this.IsString = dataType == typeof(string); this.IsStream = dataType == typeof(Stream); this.IsByteArray = dataType == typeof(byte[]); this.IsHttpResponseMessage = dataType == typeof(HttpResponseMessage); this.IsHttpResponseWrapper = dataType.IsInheritFrom <HttpResponseWrapper>(); }