public static bool MatchTypes( MondValue[] values, Type[] types ) { if( values.Length != types.Length ) return false; return values.Zip( types, ( a, b ) => new { Value = a, Type = b } ).All( x => MatchType( x.Value, x.Type ) ); }
public static object[] MarshalToClr( MondValue[] values, Type[] expectedTypes, MondState state ) { if( !MatchTypes( values, expectedTypes ) ) throw new ArgumentException( "Given values do not match expected types", "values" ); return values.Zip( expectedTypes, ( a, b ) => new { Value = a, ExpectedType = b } ).Select( x => MarshalToClr( x.Value, x.ExpectedType, state ) ).ToArray(); }