c# store generic type without arguments
public interface IModel<out T> where T : class
{
T Value { get; }
}
public class Model<T> : IModel<T> where T : class
{
public T Value { get; set; }
}
class Program
{
static void Main(string[] args)
{
var foo = new Model<string>()
{
Value = "hello world",
};
IModel<object> boo = foo;
Console.WriteLine(boo.Value);
}
}
Also in C#:
- c# check to see if dictionary key exists
- c# md5 hash file
- asp.net core 3.1: cast jObject to dictionary<string,string>
- uncaught syntaxerror invalid or unexpected token unity webgl
- c# lambda expression
- c sharp tryparse
- unity making homing missile
- c# get index of item in list
- what data type should be for contact number in asp.net
- c# round to closest multiple
- c# checksum
- use enter key unity
- how to hide and show object in unity script
- c# events and delegates
- constructor in inherited class c#
- unity custom update
- unity rotate towards mouse
- C# .net core convert string to enum
- repeat 10 timesw c#
- how to make game unity c#
- how to change scenes in unity
- internal c#
- gfortran: declare an array
- add row count devepxress report