HslExtensionGetValueOrDefaultT 方法 |
一个泛型方法,提供json对象的数据读取
A generic method that provides data read for a JSON object
命名空间:
HslCommunication
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public static T GetValueOrDefault<T>(
JObject jObject,
string name,
T defaultValue
)
Public Shared Function GetValueOrDefault(Of T) (
jObject As JObject,
name As String,
defaultValue As T
) As T
public:
generic<typename T>
static T GetValueOrDefault(
JObject^ jObject,
String^ name,
T defaultValue
)
static member GetValueOrDefault :
jObject : JObject *
name : string *
defaultValue : 'T -> 'T
参数
- jObject
- 类型:JObject
[缺少 "M:HslCommunication.HslExtension.GetValueOrDefault``1(Newtonsoft.Json.Linq.JObject,System.String,``0)" 的 <param name="jObject"/> 文档]
- name
- 类型:SystemString
值名称 - defaultValue
- 类型:T
默认值
类型参数
- T
- 读取的泛型
返回值
类型:
T值对象
示例 JObject json = new JObject( );
json.Add( "A", new JValue( "Abcdea234a" ) );
Console.WriteLine( "Abcdea234a", SoftBasic.GetValueFromJsonObject( json, "A", "" ) );
参见