Exemplo n.º 1
0
 public static ReadOnlyCollection <TypeSlim> GetGenericArguments(this MethodInfoSlim method)
 {
     return(method switch
     {
         GenericMethodInfoSlim gen => gen.GenericArguments,
         GenericDefinitionMethodInfoSlim def => def.GenericParameterTypes,
         _ => throw new InvalidOperationException(),
     });
Exemplo n.º 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>",
     });
Exemplo n.º 3
0
 protected override int MakeGenericMethod(GenericMethodInfoSlim method, int methodDefinition) => Combine((int)method.MemberType, methodDefinition, Visit(method.GenericArguments));
Exemplo n.º 4
0
 protected override int MakeGenericMethod(GenericMethodInfoSlim method, int methodDefinition) => methodDefinition + 2;
Exemplo n.º 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())));
 }