Ejemplo n.º 1
0
 private static bool CanAssignToConcreteType(ClrType assignee, StructuredType targetType)
 {
     while (assignee != null)
     {
         var assigneeType = structuredTypeFactory.CreateFromClrType(assignee);
         if (targetType.Equals(assigneeType))
         {
             return(true);
         }
         assignee = assignee.BaseType;
     }
     return(false);
 }
Ejemplo n.º 2
0
 private static bool CanAssignToInterfaceType(ClrType assignee, StructuredType targetType)
 {
     return(EnumerateInterfaces(assignee).Contains(targetType));
 }
Ejemplo n.º 3
0
 public static bool CanBeAssignedTo(this ClrType assignee, StructuredType targetType, bool targetIsInterface)
 {
     return(targetIsInterface ? CanAssignToInterfaceType(assignee, targetType) : CanAssignToConcreteType(assignee, targetType));
 }