C# 클래스 Microsoft.WindowsAzure.MobileServices.JsonExtensions

Helpful extensions that make it easier to manipulate JSON values.
Nulls propagate through calls so for example, given a JSON object like { 'typeInfo': { 'bar' : 2 } }, you could just write obj.Get("typeInfo").Get("bar").AsInteger() to get the value 2. Given a JSON object like { 'baz': 2 }, you could write obj.Get("typeInfo").Get("bar").AsInteger() to get the value null.
파일 보기 프로젝트 열기: xamarin/azure-mobile-services 1 사용 예제들

공개 메소드들

메소드 설명
Append ( this array, JToken value ) : Newtonsoft.Json.Linq.JArray

Add an element to a JSON array.

AsArray ( this value ) : Newtonsoft.Json.Linq.JArray

Convert a JSON value into an array, returning null if it's unable.

AsBool ( this value ) : bool?

Convert a JSON value into a bool, returning null if it's unable.

AsInteger ( this value ) : int?

Convert a JSON value into an int, returning null if it's unable.

AsNumber ( this value ) : double?

Convert a JSON value into a double, returning null if it's unable.

AsObject ( this value ) : Newtonsoft.Json.Linq.JObject

Convert a JSON value into an object, returning null if it's unable.

AsString ( this value ) : string

Convert a JSON value into a string, returning null if it's unable.

Get ( this value, string name ) : JToken

Gets a named value from an object.

GetPropertyValues ( this value ) : JToken>>.IEnumerable

Enumerate the member name/value pairs of a JSON object.

IsNull ( this value ) : bool

Determine if the value represents null.

Null ( ) : JToken

Get a null JSON value (that when serialized will stay null rather than not being written out).

Set ( this obj, string name, JToken value ) : JContainer

Set a named value on an object and return that object so multiple calls can be chained.

Set ( this obj, string name, bool value ) : JContainer

Set a named value on an object and return that object so multiple calls can be chained.

Set ( this obj, string name, double value ) : JContainer

Set a named value on an object and return that object so multiple calls can be chained.

Set ( this obj, string name, int value ) : JContainer

Set a named value on an object and return that object so multiple calls can be chained.

Set ( this obj, string name, string value ) : JContainer

Set a named value on an object and return that object so multiple calls can be chained.

TryConvert ( this value, object &propertyValue ) : bool

Try to convert a value to a CLR object.

TrySet ( this obj, string name, object value ) : bool

Set a named value on an object of any type. Unlike the other set overloads, this will attempt to convert arbitrary CLR values into the correct JSON types.

비공개 메소드들

메소드 설명
NumericCanRoundtrip ( object value, Type desiredType ) : bool

Ensure that a numeric value can safely roundtrip as a double.

메소드 상세

Append() 공개 정적인 메소드

Add an element to a JSON array.
public static Append ( this array, JToken value ) : Newtonsoft.Json.Linq.JArray
array this The array to add to.
value JToken The element to add.
리턴 Newtonsoft.Json.Linq.JArray

AsArray() 공개 정적인 메소드

Convert a JSON value into an array, returning null if it's unable.
public static AsArray ( this value ) : Newtonsoft.Json.Linq.JArray
value this The value to convert.
리턴 Newtonsoft.Json.Linq.JArray

AsBool() 공개 정적인 메소드

Convert a JSON value into a bool, returning null if it's unable.
public static AsBool ( this value ) : bool?
value this The value to convert.
리턴 bool?

AsInteger() 공개 정적인 메소드

Convert a JSON value into an int, returning null if it's unable.
public static AsInteger ( this value ) : int?
value this The value to convert.
리턴 int?

AsNumber() 공개 정적인 메소드

Convert a JSON value into a double, returning null if it's unable.
public static AsNumber ( this value ) : double?
value this The value to convert.
리턴 double?

AsObject() 공개 정적인 메소드

Convert a JSON value into an object, returning null if it's unable.
public static AsObject ( this value ) : Newtonsoft.Json.Linq.JObject
value this The value to convert.
리턴 Newtonsoft.Json.Linq.JObject

AsString() 공개 정적인 메소드

Convert a JSON value into a string, returning null if it's unable.
public static AsString ( this value ) : string
value this The value to convert.
리턴 string

Get() 공개 정적인 메소드

Gets a named value from an object.
public static Get ( this value, string name ) : JToken
value this /// The object to check (though the type is IJsonValue so multiple /// calls to Get can be chained together). ///
name string The name of the value to lookup.
리턴 JToken

GetPropertyValues() 공개 정적인 메소드

Enumerate the member name/value pairs of a JSON object.
public static GetPropertyValues ( this value ) : JToken>>.IEnumerable
value this A JSON object.
리턴 JToken>>.IEnumerable

IsNull() 공개 정적인 메소드

Determine if the value represents null.
public static IsNull ( this value ) : bool
value this The value to check.
리턴 bool

Null() 공개 정적인 메소드

Get a null JSON value (that when serialized will stay null rather than not being written out).
public static Null ( ) : JToken
리턴 JToken

Set() 공개 정적인 메소드

Set a named value on an object and return that object so multiple calls can be chained.
public static Set ( this obj, string name, JToken value ) : JContainer
obj this The object to set the value on.
name string The name to set.
value JToken The value to set.
리턴 JContainer

Set() 공개 정적인 메소드

Set a named value on an object and return that object so multiple calls can be chained.
public static Set ( this obj, string name, bool value ) : JContainer
obj this The object to set the value on.
name string The name to set.
value bool The value to set.
리턴 JContainer

Set() 공개 정적인 메소드

Set a named value on an object and return that object so multiple calls can be chained.
public static Set ( this obj, string name, double value ) : JContainer
obj this The object to set the value on.
name string The name to set.
value double The value to set.
리턴 JContainer

Set() 공개 정적인 메소드

Set a named value on an object and return that object so multiple calls can be chained.
public static Set ( this obj, string name, int value ) : JContainer
obj this The object to set the value on.
name string The name to set.
value int The value to set.
리턴 JContainer

Set() 공개 정적인 메소드

Set a named value on an object and return that object so multiple calls can be chained.
public static Set ( this obj, string name, string value ) : JContainer
obj this The object to set the value on.
name string The name to set.
value string The value to set.
리턴 JContainer

TryConvert() 공개 정적인 메소드

Try to convert a value to a CLR object.
public static TryConvert ( this value, object &propertyValue ) : bool
value this The value to convert.
propertyValue object The converted value.
리턴 bool

TrySet() 공개 정적인 메소드

Set a named value on an object of any type. Unlike the other set overloads, this will attempt to convert arbitrary CLR values into the correct JSON types.
public static TrySet ( this obj, string name, object value ) : bool
obj this The object to set the value on.
name string The name of the value to set.
value object The value to set.
리턴 bool