Handles the input text string from commandline or scripting, dealing with the conversion of this input string to .NET object in a more easy way. (转换从终端或者脚本文件之中输入的字符串的类型的转换)
InputHandler
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| ParseDateTime | 1 | Parsing the dat value from the expression text, if any exception happend, a null date value will returned. |
| CTypeDynamic | 3 | Parse the target string value collection as a new array in the given element target type |
| CTypeDynamic | 1 | Converts a string expression which was input from the console or script file to the specified type. |
| DefaultTextParser | 1 | 默认的字符串解析方法为InputHandler.CTypeDynamic())脚本值动态转换函数 |
| IsPrimitive | 1 | Does this type can be cast from the String type? |
| CapabilityPromise | 1 | Dynamics updates the capability of function InputHandler.CTypeDynamic()), InputHandler.CTypeDynamic()) and InputHandler.IsPrimitive()) |
| GetType | 2 | Get .NET Type definition info from its name. |
| Convertible | 1 | Does the inputtype type can be cast to type DefType. |
| ToString | 2 | |
| CastArray | 1 | The parameter obj should implements a IEnumerable interface on the type. |
| DirectCast | 1 | Cast the Object array to typed object array. |
| StringParser | 1 | |
| DefaultTextParser | 1 | |
| IsNullablePrimitive | 1 | |
| GetString | 1 | |
| CastArray | 2 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| CasterString | 1 | Object为字符串类型,这个字典可以讲字符串转为目标类型 |
| Types | 1 | Enumerate all of the types that can be handled in this module. |
| String | 1 | Type information for String type from GetType operator |
04 Members
String)Parsing the dat value from the expression text, if any exception happend, a null date value will returned. (空字符串会返回空的日期)
| Name | Type | Description |
|---|---|---|
s | String | - |
IEnumerable(Of String), Type)Parse the target string value collection as a new array in the given element target type
| Name | Type | Description |
|---|---|---|
expression | IEnumerable(Of String) | A collection of object data in string value |
target | Type | The element type |
String, Type)Converts a string expression which was input from the console or script file to the specified type.
If all failure, then will try Conversion.CTypeDynamic(). (请注意,函数只是转换最基本的数据类型,转换错误会返回空值,空字符串也会返回空值)
| Name | Type | Description |
|---|---|---|
expression | String | The string expression to convert. |
target | Type | The type to which to convert the object. |
An object whose type at run time is the requested target type.
IEnumerable, Type)the given type value should be the target array element type.
| Name | Type | Description |
|---|---|---|
array | IEnumerable | - |
type | Type | - |
String, ``0)Converts a string expression which was input from the console or script file to the specified type.
(请注意,函数只是转换最基本的数据类型,转换错误会返回空值,空字符串也会返回空值)
| Name | Description |
|---|---|
T | The type to which to convert the object. |
| Name | Type | Description |
|---|---|---|
expr | String | The string expression to convert. |
An object whose type at run time is the requested target type.
默认的字符串解析方法为InputHandler.CTypeDynamic()脚本值动态转换函数
| Name | Description |
|---|---|
T |
Type)Does this type can be cast from the String type?
(目标类型能否由字符串转换过来??)
| Name | Type | Description |
|---|---|---|
targetType | Type | - |
Dynamics updates the capability of function InputHandler.CTypeDynamic(), InputHandler.CTypeDynamic() and InputHandler.IsPrimitive()
| Name | Type | Description |
|---|---|---|
briefName | String | - |
stringConvertType | Type | - |
cast | LoadObject | - |
String, Boolean)Get .NET clr Type definition info from its name. (类型获取失败会返回空值,大小写不敏感)
| Name | Type | Description |
|---|---|---|
name | String | Case insensitive.(类型的名称简写) |
ObjectGeneric | Boolean | 是否出错的时候返回 |
Boolean)Get .NET Type definition info from its name. (类型获取失败会返回空值,大小写不敏感)
| Name | Type | Description |
|---|---|---|
name | Value(Of String) | Case insensitive.(类型的名称简写) |
ObjectGeneric | Boolean | 是否出错的时候返回 |
Type, Type)Does the inputtype type can be cast to type DefType. (主要为了方便减少脚本编程模块的代码)
| Name | Type | Description |
|---|---|---|
inputType | Type | - |
DefType | Type | - |
Object, String, Boolean)NumberConversionRoutines.CStrSafe(), 出现错误的时候总是会返回空字符串的,
注意:
- 对于一些基础的数据类型例如
Int32,Int64等则是以json序列化来构建字符串值, - 对于Byte数组则是被编码为base64字符串
| Name | Type | Description |
|---|---|---|
obj | Object | - |
originToStringAsNothing | String | Result of |
Object)The parameter obj should implements a IEnumerable interface on the type. and then DirectCast object to target type.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
obj | Object | - |
IEnumerable, Type)Cast the Object array to typed object array.
please note that, this function cast type by using direct cast, without any type conversion. type-mismatch error may be happends.
| Name | Type | Description |
|---|---|---|
array | IEnumerable | - |
type | Type | 数组里面的元素的类型 |
Object为字符串类型,这个字典可以讲字符串转为目标类型
Enumerate all of the types that can be handled in this module. All of the key string is in lower case.(键值都是小写的)
Type information for String type from GetType operator
Type)Type)Object)Object, Type)