JsonPrimitive Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents a JavaScript Object Notation (JSON) primitive type in the common language runtime (CLR).
Inheritance Hierarchy
System.Object
System.Json.JsonValue
System.Json.JsonPrimitive
Namespace: System.Json
Assembly: System.Json (in System.Json.dll)
Syntax
'Declaration
Public Class JsonPrimitive _
Inherits JsonValue
public class JsonPrimitive : JsonValue
The JsonPrimitive type exposes the following members.
Constructors
Name | Description | |
---|---|---|
JsonPrimitive(Boolean) | Initializes a new instance of a JsonPrimitive type with a Boolean type. | |
JsonPrimitive(Byte) | Initializes a new instance of a JsonPrimitive type with a Byte type. | |
JsonPrimitive(Char) | Initializes a new instance of a JsonPrimitive type with a Char type. | |
JsonPrimitive(DateTime) | Initializes a new instance of a JsonPrimitive type with a DateTime type. | |
JsonPrimitive(Decimal) | Initializes a new instance of a JsonPrimitive type with a Decimal type. | |
JsonPrimitive(Double) | Initializes a new instance of a JsonPrimitive type with a Double type. | |
JsonPrimitive(Guid) | Initializes a new instance of a JsonPrimitive type with a Guid type. | |
JsonPrimitive(Int16) | Initializes a new instance of a JsonPrimitive type with a Int16 type. | |
JsonPrimitive(Int32) | Initializes a new instance of a JsonPrimitive type with a Int32 type. | |
JsonPrimitive(Int64) | Initializes a new instance of a JsonPrimitive type with a Int64 type. | |
JsonPrimitive(SByte) | Initializes a new instance of a JsonPrimitive type with a SByte type. | |
JsonPrimitive(Single) | Initializes a new instance of a JsonPrimitive type with a Single type. | |
JsonPrimitive(String) | Initializes a new instance of a JsonPrimitive type with a String type. | |
JsonPrimitive(TimeSpan) | Initializes a new instance of a JsonPrimitive type with a TimeSpan type. | |
JsonPrimitive(UInt16) | Initializes a new instance of a JsonPrimitive type with a UInt16 type. | |
JsonPrimitive(UInt32) | Initializes a new instance of a JsonPrimitive type with a UInt32 type. | |
JsonPrimitive(UInt64) | Initializes a new instance of a JsonPrimitive type with a UInt64 type. | |
JsonPrimitive(Uri) | Initializes a new instance of a JsonPrimitive type with a Uri type. |
Top
Properties
Name | Description | |
---|---|---|
Count | This method is not supported and throws an exception when called. (Inherited from JsonValue.) | |
Item[Int32] | This indexer is not supported for this base class and throws an exception. (Inherited from JsonValue.) | |
Item[String] | This indexer is not supported for this base class and throws an exception. (Inherited from JsonValue.) | |
JsonType | Gets the JsonType that is associated with this JsonPrimitive object. (Overrides JsonValue.JsonType.) |
Top
Methods
Name | Description | |
---|---|---|
ContainsKey | Throws an InvalidOperationException. (Inherited from JsonValue.) | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Save(Stream) | Serializes the JsonPrimitive object into text-based JSON. (Overrides JsonValue.Save(Stream).) | |
Save(TextWriter) | Serializes the JsonValue CLR type into text-based JSON using a text writer. (Inherited from JsonValue.) | |
ToString | Saves (serializes) this JSON CLR type into text-based JSON. (Inherited from JsonValue.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
IEnumerable.GetEnumerator | This method is not supported for this base class and throws an exception. (Inherited from JsonValue.) |
Top
Remarks
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.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.