I am trying to get the type of a dynamic linq column using
var args = ((dynamic)linqColumn).PropertyType.GenericTypeArguments;
then comparing on the possible types names :
if (args.Length > 0 && args[0].Name == "DateTime")
ProcessDateTimeType();
else if (args.Length > 0 && args[0].Name == "Double")
ProcessDoubleType();
This works on a Windows Vista with .NET 4.0, but does not work with a Windows Server 2003 also with .NET 4.0. An error 'System.Type' does not contain a definition for 'GenericTypeArguments' is throwed.
Any idea ?
Remarks
linqColumnis obtained viavar linqColumn = linqTableType.GetProperty("COLNAME");linqTableTypeis obtained via'Type linqTableType = Type.GetType("MYNAMESPACE." + "TABLENAME");- Code is executed inside a web service
Aucun commentaire:
Enregistrer un commentaire