点击或拖拽改变大小

HslExtensionGetValueOrDefaultT 方法

一个泛型方法,提供json对象的数据读取
A generic method that provides data read for a JSON object

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static T GetValueOrDefault<T>(
	JObject jObject,
	string name,
	T defaultValue
)

参数

jObject
类型:JObject

[缺少 "M:HslCommunication.HslExtension.GetValueOrDefault``1(Newtonsoft.Json.Linq.JObject,System.String,``0)" 的 <param name="jObject"/> 文档]

name
类型:SystemString
值名称
defaultValue
类型:T
默认值

类型参数

T
读取的泛型

返回值

类型:T
值对象
示例
GetValueFromJsonObject示例
JObject json = new JObject( );
json.Add( "A", new JValue( "Abcdea234a" ) );

Console.WriteLine( "Abcdea234a", SoftBasic.GetValueFromJsonObject( json, "A", "" ) );

// 输出 true
参见