mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-10 16:28:41 +00:00
24 lines
472 B
C#
24 lines
472 B
C#
public class Program
|
|
{
|
|
public class Container<T>
|
|
{
|
|
public T Value { get; set; }
|
|
}
|
|
|
|
public static int Main(string[] args)
|
|
{
|
|
Container<int> intContainer = new Container<int> { Value = 42 };
|
|
|
|
// Cast generic type to object
|
|
object obj = (object)intContainer;
|
|
|
|
// Check type and cast back
|
|
if (obj is Container<int> container)
|
|
{
|
|
return container.Value;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|