public static Type[] GetTypes(ArgDirection dir, ParameterInfo[] parms) { List <Type> types = new List <Type> (); //TODO: consider InOut/Ref for (int i = 0; i != parms.Length; i++) { switch (dir) { case ArgDirection.In: //docs say IsIn isn't reliable, and this is indeed true //if (parms[i].IsIn) if (!parms[i].IsOut) { types.Add(parms[i].ParameterType); } break; case ArgDirection.Out: if (parms[i].IsOut) { //TODO: note that IsOut is optional to the compiler, we may want to use IsByRef instead //eg: if (parms[i].ParameterType.IsByRef) types.Add(parms[i].ParameterType.GetElementType()); } break; } } return(types.ToArray()); }
public static Type[] GetTypes(ArgDirection dir, ParameterInfo[] parms) { List<Type> types = new List<Type> (); //TODO: consider InOut/Ref for (int i = 0 ; i != parms.Length ; i++) { switch (dir) { case ArgDirection.In: //docs say IsIn isn't reliable, and this is indeed true //if (parms[i].IsIn) if (!parms[i].IsOut) types.Add (parms[i].ParameterType); break; case ArgDirection.Out: if (parms[i].IsOut) { //TODO: note that IsOut is optional to the compiler, we may want to use IsByRef instead //eg: if (parms[i].ParameterType.IsByRef) types.Add (parms[i].ParameterType.GetElementType ()); } break; } } return types.ToArray (); }