Export (0) Print
Expand All

JsonPrimitive Class

Represents a JavaScript Object Notation (JSON) primitive type in the common language runtime (CLR).

Namespace:  System.Json
Assembly:  System.Json (in System.Json.dll)

public class JsonPrimitive : JsonValue

The JsonPrimitive type exposes the following members.

  NameDescription
Public methodJsonPrimitive(Boolean)Initializes a new instance of a JsonPrimitive type with a Boolean type.
Public methodJsonPrimitive(Byte)Initializes a new instance of a JsonPrimitive type with a Byte type.
Public methodJsonPrimitive(Char)Initializes a new instance of a JsonPrimitive type with a Char type.
Public methodJsonPrimitive(DateTime)Initializes a new instance of a JsonPrimitive type with a DateTime type.
Public methodJsonPrimitive(Decimal)Initializes a new instance of a JsonPrimitive type with a Decimal type.
Public methodJsonPrimitive(Double)Initializes a new instance of a JsonPrimitive type with a Double type.
Public methodJsonPrimitive(Guid)Initializes a new instance of a JsonPrimitive type with a Guid type.
Public methodJsonPrimitive(Int16)Initializes a new instance of a JsonPrimitive type with a Int16 type.
Public methodJsonPrimitive(Int32)Initializes a new instance of a JsonPrimitive type with a Int32 type.
Public methodJsonPrimitive(Int64)Initializes a new instance of a JsonPrimitive type with a Int64 type.
Public methodJsonPrimitive(SByte)Initializes a new instance of a JsonPrimitive type with a SByte type.
Public methodJsonPrimitive(Single)Initializes a new instance of a JsonPrimitive type with a Single type.
Public methodJsonPrimitive(String)Initializes a new instance of a JsonPrimitive type with a String type.
Public methodJsonPrimitive(TimeSpan)Initializes a new instance of a JsonPrimitive type with a TimeSpan type.
Public methodJsonPrimitive(UInt16)Initializes a new instance of a JsonPrimitive type with a UInt16 type.
Public methodJsonPrimitive(UInt32)Initializes a new instance of a JsonPrimitive type with a UInt32 type.
Public methodJsonPrimitive(UInt64)Initializes a new instance of a JsonPrimitive type with a UInt64 type.
Public methodJsonPrimitive(Uri)Initializes a new instance of a JsonPrimitive type with a Uri type.
Top

  NameDescription
Public propertyCountThis method is not supported and throws an exception when called. (Inherited from JsonValue.)
Public propertyItem[Int32]This indexer is not supported for this base class and throws an exception. (Inherited from JsonValue.)
Public propertyItem[String]This indexer is not supported for this base class and throws an exception. (Inherited from JsonValue.)
Public propertyJsonTypeGets the JsonType that is associated with this JsonPrimitive object. (Overrides JsonValue.JsonType.)
Top

  NameDescription
Public methodContainsKeyThrows an InvalidOperationException. (Inherited from JsonValue.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSave(Stream)Serializes the JsonPrimitive object into text-based JSON. (Overrides JsonValue.Save(Stream).)
Public methodSave(TextWriter)Serializes the JsonValue CLR type into text-based JSON using a text writer. (Inherited from JsonValue.)
Public methodToStringSaves (serializes) this JSON CLR type into text-based JSON. (Inherited from JsonValue.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorThis method is not supported for this base class and throws an exception. (Inherited from JsonValue.)
Top

The exact type stored is indicated by the JsonType property. The public constructors in this class allow the creation of JsonPrimitive objects associated with three JsonType objects: Number, String, and Boolean.

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2015 Microsoft