Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IsAssignableFrom() [2/4]

virtual bool System.Type.IsAssignableFrom ( [NotNullWhen(true)] Type? c)
inlinevirtualinherited

Reimplemented in System.Reflection.Emit.GenericTypeParameterBuilder, and System.Reflection.Emit.TypeBuilder.

Definition at line 1561 of file Type.cs.

1562 {
1563 if (c == null)
1564 {
1565 return false;
1566 }
1567 if (this == c)
1568 {
1569 return true;
1570 }
1571 Type underlyingSystemType = UnderlyingSystemType;
1572 if ((object)underlyingSystemType != null && underlyingSystemType.IsRuntimeImplemented())
1573 {
1574 return underlyingSystemType.IsAssignableFrom(c);
1575 }
1576 if (c.IsSubclassOf(this))
1577 {
1578 return true;
1579 }
1580 if (IsInterface)
1581 {
1582 return c.ImplementInterface(this);
1583 }
1585 {
1586 Type[] genericParameterConstraints = GetGenericParameterConstraints();
1587 for (int i = 0; i < genericParameterConstraints.Length; i++)
1588 {
1589 if (!genericParameterConstraints[i].IsAssignableFrom(c))
1590 {
1591 return false;
1592 }
1593 }
1594 return true;
1595 }
1596 return false;
1597 }
bool IsInterface
Definition Type.cs:30
virtual bool IsAssignableFrom([NotNullWhen(true)] Type? c)
Definition Type.cs:1561
virtual Type[] GetGenericParameterConstraints()
Definition Type.cs:505
Type UnderlyingSystemType
Definition Type.cs:61
virtual bool IsGenericParameter
Definition Type.cs:85

References System.Type.GetGenericParameterConstraints(), System.Type.ImplementInterface(), System.Type.IsAssignableFrom(), System.Type.IsGenericParameter, System.Type.IsInterface, System.Type.IsRuntimeImplemented(), System.Type.IsSubclassOf(), and System.Type.UnderlyingSystemType.

Referenced by System.Linq.Expressions.ConstantCheck.AnalyzeTypeIs(), System.Dynamic.Utils.TypeUtils.AreReferenceAssignable(), System.DefaultBinder.BindToField(), System.DefaultBinder.BindToMethod(), System.ComponentModel.TypeDescriptor.CheckDefaultProvider(), System.Reflection.DispatchProxyGenerator.ProxyBuilder.Convert(), System.Linq.Expressions.Compiler.ILGen.EmitConvertToType(), System.DefaultBinder.FindMostSpecificType(), System.Reflection.Emit.DynamicMethod.RTDynamicMethod.GetCustomAttributes(), System.Dynamic.Utils.TypeUtils.HasReferenceConversionTo(), System.Runtime.Serialization.CodeGenerator.InternalConvert(), System.Xml.Serialization.CodeGenerator.InternalConvert(), System.Type.IsAssignableFrom(), System.Type.IsAssignableTo(), System.Reflection.Emit.DynamicMethod.RTDynamicMethod.IsDefined(), System.Type.IsInstanceOfType(), System.Linq.Expressions.Interpreter.ExceptionHandler.Matches(), System.Security.AccessControl.ObjectSecurity< T >.ModifyAccessRule(), System.Security.AccessControl.ObjectSecurity< T >.ModifyAuditRule(), System.Linq.Expressions.Interpreter.CastInstruction.CastInstructionNoT.Run(), System.DefaultBinder.SelectMethod(), System.DefaultBinder.SelectProperty(), System.ComponentModel.DataAnnotations.RangeAttribute.SetupConversion(), System.Dynamic.Utils.TypeUtils.StrictHasReferenceConversionTo(), System.Xml.Serialization.TypeExtensions.TryConvertTo(), System.Xml.Serialization.XmlSerializationReaderCodeGen.WriteDerivedSerializable(), and System.Xml.Serialization.XmlSerializationReaderILGen.WriteDerivedSerializable().