Wrapper Class
Definition
- Namespace
- Cuemon.Extensions
- Assemblies
- Cuemon.Extensions.Core.dll
Provides helper method for a Wrapper<T> object.
public static class Wrapper
- Inheritance
-
Wrapper
Examples
The following example demonstrates how to wrap values using Wrapper<T> to access the inner instance, its type, and a parsed string representation. It shows wrapping both an integer and a string value.
using System;
using Cuemon;
using Cuemon.Extensions;
namespace Cuemon.Extensions;
public class WrapperExample
{
public void Demonstrate()
{
var wrapped = new Wrapper<int>(42);
Console.WriteLine(wrapped.Instance);
Console.WriteLine(wrapped.InstanceType);
string parsed = Wrapper.ParseInstance(wrapped);
Console.WriteLine(parsed);
int asInt = wrapped.InstanceAs<int>();
Console.WriteLine(asInt);
var wrappedString = new Wrapper<string>("Hello, World!");
Console.WriteLine(Wrapper.ParseInstance(wrappedString));
}
}
Methods
| Name | Description |
|---|---|
| ParseInstance<T>(IWrapper<T>) | Parses the encapsulated instance of the specified |