示例#1
0
 public static ReadOnlyCollection <TypeSlim> GetGenericArguments(this MethodInfoSlim method)
 {
     return(method switch
     {
         GenericMethodInfoSlim gen => gen.GenericArguments,
         GenericDefinitionMethodInfoSlim def => def.GenericParameterTypes,
         _ => throw new InvalidOperationException(),
     });
示例#2
0
 public static string GetName(this MemberInfoSlim m)
 {
     return(m switch
     {
         SimpleMethodInfoSlimBase smtd => smtd.Name,
         GenericMethodInfoSlim gmtd => gmtd.GenericMethodDefinition.GetName(),
         PropertyInfoSlim prp => prp.Name,
         FieldInfoSlim fld => fld.Name,
         _ => "<unknown>",
     });
示例#3
0
 protected override int MakeGenericMethod(GenericMethodInfoSlim method, int methodDefinition) => Combine((int)method.MemberType, methodDefinition, Visit(method.GenericArguments));
 protected override int MakeGenericMethod(GenericMethodInfoSlim method, int methodDefinition) => methodDefinition + 2;
示例#5
0
 private static void AssertAreSameGenericMethod(MethodInfo methodInfo, GenericMethodInfoSlim genericMethodInfoSlim)
 {
     AssertAreSameMethod(methodInfo.GetGenericMethodDefinition(), genericMethodInfoSlim.GenericMethodDefinition);
     Assert.IsTrue(genericMethodInfoSlim.GenericArguments.SequenceEqual(methodInfo.GetGenericArguments().Select(t => t.ToTypeSlim())));
 }