 | DataReaderExGetTypeInstanceSafeT 方法 (IDataReader, String, Type) |
Sweet 开发框架
Gets the record value as class instance from a type name or the specified default type.
命名空间:
Sweet.Common
程序集:
Sweet.Common (在 Sweet.Common.dll 中) 版本:3.10.1.0 (3.10.1.0)
语法public static T GetTypeInstanceSafe<T>(
this IDataReader reader,
string field,
Type type
)
where T : class
<ExtensionAttribute>
Public Shared Function GetTypeInstanceSafe(Of T As Class) (
reader As IDataReader,
field As String,
type As Type
) As T
[<ExtensionAttribute>]
static member GetTypeInstanceSafe :
reader : IDataReader *
field : string *
type : Type -> 'T when 'T : not struct
参数
- reader
- 类型:System.DataIDataReader
The data reader. - field
- 类型:SystemString
The name of the record field. - type
- 类型:SystemType
The type.
类型参数
- T
- The type to be casted to
返回值
类型:
TThe record value
备注
在 Visual Basic 和 C# 中,这个方法可以当成为类型
IDataReader 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考
扩展方法 (Visual Basic) 或
扩展方法 (C# 编程指南) 获取更多信息。
参见