Skip to content

Instantly share code, notes, and snippets.

@xepherys
xepherys / Cast From Object to Generic
Created February 2, 2023 14:59
Cast from an object to the target type of a generic in a generic Class<T>.
using System;
public class Program
{
public static void Main()
{
int myInt = 5;
TestValue<float> testValue = new TestValue<float>();