How do I get the type argument of a generic type?

Try this to get the entity type of the table var tableType =table.GetType(). GetGenericArguments()0.

Type GetType(Table table) { return typeof(T); } var table = new DataContext(). TABLE1s; // this is Table var tableType = GetType(table).

Well.. didn't think of that! Was too caught up in using reflection.. duh! – benpage Mar 31 '10 at 0:21 too many notes.... ;-) youtube.Com/watch?

V=dCud8H7z7vU – Sky Sanders Mar 31 '10 at 0:22.

You can declare variant generic interfaces by using the in and out keywords for generic type parameters. You can declare a generic type parameter covariant by using the out keyword. The type is used only as a return type of interface methods and not used as a type of method arguments.

This is illustrated in the following example, in which the type R is declared covariant. // The following statement generates a compiler error. There is one exception to this rule.

If you have a contravariant generic delegate as a method parameter, you can use the type as a generic type parameter for the delegate. This is illustrated by the type R in the following example. For more information, see Variance in Delegates (C# and Visual Basic) and Using Variance for Func and Action Generic Delegates (C# and Visual Basic).

The type is not used as a generic constraint for the interface methods. This is illustrated in the following code. // in generic contstraints.

You can declare a generic type parameter contravariant by using the in keyword. The contravariant type can be used only as a type of method arguments and not as a return type of interface methods. The contravariant type can also be used for generic constraints.

The following code shows how to declare a contravariant interface and use a generic constraint for one of its methods. It is also possible to support both covariance and contravariance in the same interface, but for different type parameters, as shown in the following code example. In Visual Basic, you cannot declare events in variant interfaces without specifying the delegate type.

Also, a variant interface cannot have nested classes, enums, or structures, but it can have nested interfaces. This is illustrated in the following code.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions