Formatter Class
Definition
- Namespace
- Cuemon.Runtime.Serialization.Formatters
- Assemblies
- Cuemon.Core.dll
Provides a set of static methods that complements serialization and deserialization of an object.
public static class Formatter
- Inheritance
-
objectFormatter
Examples
The following example shows how to resolve .NET types from qualified type-name strings using the Formatter class. It demonstrates both a direct resolution and a safe TryGetType call that avoids exceptions.
using System;
using Cuemon.Runtime.Serialization.Formatters;
namespace Cuemon.Runtime.Serialization.Formatters;
public class FormatterExample
{
public void Demonstrate()
{
var type = Formatter.GetType("System.DateTime, mscorlib");
Console.WriteLine($"Resolved type: {type}");
if (Formatter.TryGetType("Cuemon.GuidStringOptions, Cuemon.Core", out var optionsType))
{
Console.WriteLine($"Found type: {optionsType}");
}
}
}
Methods
| Name | Description |
|---|---|
| GetType(string) | Gets the Type with the specified |
| TryGetType(string, out Type) | Attempts to get the Type with the specified |