Table of Contents

Class RegistryBase

Namespace
nanoFramework.WebServer.Skills
Assembly
nanoFramework.WebServer.Skills.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.

Exceptions

InvalidCastException

Thrown when the value cannot be converted to the target type (e.g. invalid boolean string).

CreateInstance(Type)

Creates an instance of a type using its parameterless constructor.

protected static object CreateInstance(Type type)

Parameters

type Type

The type to create an instance of.

Returns

object

A new instance of the type.

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.

Exceptions

InvalidCastException

Thrown when a property value cannot be converted to the expected type.