Class JsonConversion.JsonConverterSet
Represents a set of JsonConverter objects, making sure there's at most one custom converter for each type. For example, a class MyClass cannot have two JSON converters defined for it in the list.
NOTE: Accessing converters is O(1).
public class JsonConversion.JsonConverterSet : IEnumerable
- Inheritance
-
JsonConversion.JsonConverterSet
- Implements
- Inherited Members
Constructors
JsonConverterSet()
Creates an empty JsonConverterSet.
public JsonConverterSet()
JsonConverterSet(IEnumerable)
public JsonConverterSet(IEnumerable converters)
Parameters
converters
IEnumerable
JsonConverterSet(params object[])
Creates a JsonConverterSet with the given converters. Throws an error if an object is not a type that implements JsonConverter, or if the set already contains a converter for the type a converter converts.
public JsonConverterSet(params object[] converters)
Parameters
converters
object[]
Methods
Add(object)
Adds the converter to the set. Throws an error if it is not a type that implements JsonConverter, or if the set already contains a converter for the type the converter converts.
public void Add(object converter)
Parameters
converter
object
ContainsConverterFor(Type)
Returns whether the set contains a converter that converts the given type.
public bool ContainsConverterFor(Type converterType)
Parameters
converterType
Type
Returns
- bool
true if the set has a converter for the given type.
GetConverterFor(Type)
If the set contains a converter that converts the given type, this will return it.
public object GetConverterFor(Type converterType)
Parameters
converterType
Type
Returns
- object
The converter for the given type, if there is one, otherwise null.
GetEnumerator()
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
RemoveConverterFor(Type)
If the set contains a converter that converts the given type, this will remove it.
public bool RemoveConverterFor(Type converterType)
Parameters
converterType
Type
Returns
- bool
true if a converter was removed.