Table of Contents

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

value object

The value to convert.

targetType Type

The target primitive type to convert to.

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

type Type

The 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

hashtable Hashtable

The Hashtable containing the data to deserialize.

targetType Type

The 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.