Table of Contents

Wrapper Class

Definition

Namespace
Cuemon.Extensions
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/Wrapper.cs

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.

// Program.cs
using System;
using Cuemon;
using Cuemon.Extensions;

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 wrapper for a human-readable string value.