SoftBasicGetValueFromJsonObjectT 方法 |
一个泛型方法,提供json对象的数据读取
A generic method that provides data read for a JSON object
命名空间:
HslCommunication.BasicFramework
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.0.0 (12.1.0.0)
语法public static T GetValueFromJsonObject<T>(
JObject json,
string name,
T defaultValue
)
Public Shared Function GetValueFromJsonObject(Of T) (
json As JObject,
name As String,
defaultValue As T
) As T
public:
generic<typename T>
static T GetValueFromJsonObject(
JObject^ json,
String^ name,
T defaultValue
)
static member GetValueFromJsonObject :
json : JObject *
name : string *
defaultValue : 'T -> 'T
参数
- json
- 类型:JObject
json对象 - name
- 类型:SystemString
值名称 - defaultValue
- 类型:T
默认值
类型参数
- T
- 读取的泛型
返回值
类型:
T值对象
示例JObject json = new JObject( );
json.Add( "A", new JValue( "Abcdea234a" ) );
Console.WriteLine( "Abcdea234a", SoftBasic.GetValueFromJsonObject( json, "A", "" ) );
参见