Class RegistryBase
- Namespace
- nanoFramework.WebServer.Mcp
- Assembly
- nanoFramework.WebServer.Mcp.dll
Base class for registries that support conversion and deserialization of objects.
public abstract class RegistryBase
- Inheritance
-
RegistryBase
- Derived
- Inherited Members
- Extension Methods
Constructors
RegistryBase()
protected RegistryBase()
Methods
ConvertToPrimitiveType(object, Type)
Converts a value to the specified primitive type with appropriate type conversion and error handling.
protected static object ConvertToPrimitiveType(object value, Type targetType)
Parameters
Returns
- object
The converted value as the target type.
CreateInstance(Type)
Creates an instance of a tool or prompt method using its parameterless constructor.
protected static object CreateInstance(Type type)
Parameters
typeTypeThe type of the tool or prompt method to create an instance of.
Returns
- object
The result of the method invocation.
Exceptions
- Exception
Thrown when the type does not have a parameterless constructor.
DeserializeFromHashtable(Hashtable, Type)
Recursively deserializes a Hashtable into a strongly-typed object by mapping properties and handling nested objects.
protected static object DeserializeFromHashtable(Hashtable hashtable, Type targetType)
Parameters
hashtableHashtableThe Hashtable containing the data to deserialize.
targetTypeTypeThe target type to deserialize the data into.
Returns
- object
A new instance of the target type with properties populated from the Hashtable, or null if hashtable or targetType is null.