Beispiel #1
0
 private static ConversionClass ClassifyCLRConversionForArrayElementTypes(Type TargetElementType, Type SourceElementType)
 {
     if (Symbols.IsReferenceType(SourceElementType) && Symbols.IsReferenceType(TargetElementType))
     {
         return(ClassifyPredefinedCLRConversion(TargetElementType, SourceElementType));
     }
     if (Symbols.IsValueType(SourceElementType) && Symbols.IsValueType(TargetElementType))
     {
         return(ClassifyPredefinedCLRConversion(TargetElementType, SourceElementType));
     }
     if (Symbols.IsGenericParameter(SourceElementType) && Symbols.IsGenericParameter(TargetElementType))
     {
         if (SourceElementType == TargetElementType)
         {
             return(ConversionClass.Identity);
         }
         if (Symbols.IsReferenceType(SourceElementType) && Symbols.IsOrInheritsFrom(SourceElementType, TargetElementType))
         {
             return(ConversionClass.Widening);
         }
         if (Symbols.IsReferenceType(TargetElementType) && Symbols.IsOrInheritsFrom(TargetElementType, SourceElementType))
         {
             return(ConversionClass.Narrowing);
         }
     }
     return(ConversionClass.None);
 }