/// <summary> /// Gets the string param. /// </summary> /// <param name="request">The request.</param> /// <param name="paramName">Name of the param.</param> /// <param name="errorReturn">The error return.</param> /// <returns>The param value.</returns> public static TReturn GetRequestParam <TReturn>(System.Web.HttpRequest request, string paramName, TReturn errorReturn) { string retStr = request.Headers[paramName]; if (retStr == null) { retStr = request.Form[paramName]; } if (retStr == null) { retStr = request.QueryString[paramName]; } if (retStr == null) { return(errorReturn); } return(CoreHelper.ConvertTo <TReturn>(retStr, errorReturn)); }
/// <summary> /// 将value转换成对应的类型值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="outValue"></param> /// <returns></returns> public static T ConvertTo <T>(string value, T outValue) { return(CoreHelper.ConvertTo <T>(value, outValue)); }
/// <summary> /// 将value转换成对应的类型值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="defvalue"></param> /// <returns></returns> public T To <T>(T defvalue) { return(CoreHelper.ConvertTo <T>(this.keyValue, defvalue)); }