if (type == null)
throw new NullReferenceException();
- Stream? s = type.GetTypeInfo().Assembly.GetManifestResourceStream(type, resource);
+ Stream? s = type.Assembly.GetManifestResourceStream(type, resource);
if (s == null)
{
string msg = string.Format("Resource '{0}' was not found.", resource);
if (destinationType == typeof(InstanceDescriptor))
{
- ConstructorInfo? met = typeof(Font).GetTypeInfo().GetConstructor(new Type[] { typeof(string), typeof(float), typeof(FontStyle), typeof(GraphicsUnit) });
+ ConstructorInfo? met = typeof(Font).GetConstructor(new Type[] { typeof(string), typeof(float), typeof(FontStyle), typeof(GraphicsUnit) });
object[] args = new object[4];
args[0] = font.Name;
args[1] = font.Size;
if (type == null)
throw new NullReferenceException();
- using (Stream? s = type.GetTypeInfo().Assembly.GetManifestResourceStream(type, resource))
+ using (Stream? s = type.Assembly.GetManifestResourceStream(type, resource))
{
if (s == null)
{
internal Icon(string resourceName, bool undisposable)
{
- using (Stream? s = typeof(Icon).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName))
+ using (Stream? s = typeof(Icon).Assembly.GetManifestResourceStream(resourceName))
{
if (s == null)
{
if (strFormat != null)
{
- return new InstanceDescriptor(typeof(ImageFormat).GetTypeInfo().GetProperty(strFormat), null);
+ return new InstanceDescriptor(typeof(ImageFormat).GetProperty(strFormat), null);
}
else
{
- ConstructorInfo? ctor = typeof(ImageFormat).GetTypeInfo().GetConstructor(new Type[] { typeof(Guid) });
+ ConstructorInfo? ctor = typeof(ImageFormat).GetConstructor(new Type[] { typeof(Guid) });
return new InstanceDescriptor(ctor, new object[] { imgFormat.Guid });
}
}
try
{
- using (System.IO.Stream? s = t.GetTypeInfo().Assembly.GetManifestResourceStream(t.Namespace + "." + imageName))
+ using (System.IO.Stream? s = t.Assembly.GetManifestResourceStream(t.Namespace + "." + imageName))
{
if (s == null)
{
Type? driver_type = asm.GetType("System.Windows.Forms.XplatUICarbon");
if (driver_type != null)
{
- return (Delegate?)driver_type.GetTypeInfo().GetField("HwndDelegate", BindingFlags.NonPublic | BindingFlags.Static)!.GetValue(null);
+ return (Delegate?)driver_type.GetField("HwndDelegate", BindingFlags.NonPublic | BindingFlags.Static)!.GetValue(null);
}
}
}
/// </summary>
public static Func<PropertyValue, PropertyValue> GetPropertyGetter(PropertyInfo property)
{
- if (property.DeclaringType!.GetTypeInfo().IsValueType)
+ if (property.DeclaringType!.IsValueType)
return GetBoxedValueTypePropertyGetter(property);
else
return GetReferenceTypePropertyGetter(property);
{
Type type = property.PropertyType;
- if (type.GetTypeInfo().IsEnum)
+ if (type.IsEnum)
type = Enum.GetUnderlyingType(type);
Func<object?, PropertyValue> factory = GetFactory(type);
}
else
{
- if (type.GetTypeInfo().IsEnum)
+ if (type.IsEnum)
type = Enum.GetUnderlyingType(type);
if (type == typeof(bool)) { var f = (Func<TContainer, bool>)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
Type[] typeArgs = type.GenericTypeArguments;
Debug.Assert(typeArgs.Length == 1);
this.valueInfo = TraceLoggingTypeInfo.GetInstance(typeArgs[0], recursionCheck);
- this.valueGetter = PropertyValue.GetPropertyGetter(type.GetTypeInfo().GetDeclaredProperty("Value")!);
+ this.valueGetter = PropertyValue.GetPropertyGetter(type.GetProperty("Value")!);
}
public override void WriteMetadata(
Func<string, object> createDirectory = LazyInitializer.EnsureInitialized(ref s_directoryCreateDirectory, static () =>
{
Type dirType = Type.GetType("System.IO.Directory, System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: true)!;
- MethodInfo mi = dirType.GetTypeInfo().GetDeclaredMethod("CreateDirectory")!;
+ MethodInfo mi = dirType.GetMethod("CreateDirectory", BindingFlags.Public | BindingFlags.Static)!;
return mi.CreateDelegate<Func<string, object>>();
});
createDirectory(path);
{
Debug.Assert(type != null);
- if (o == null)
- return false;
-
- return type.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo());
+ return o != null && type.IsAssignableFrom(o.GetType());
}
}
}
<argument>ILLink</argument>
<argument>IL2070</argument>
<property name="Scope">member</property>
- <property name="Target">M:System.Xml.Serialization.ReflectionXmlSerializationReader.FindDefaultConstructor(System.Reflection.TypeInfo)</property>
+ <property name="Target">M:System.Xml.Serialization.ReflectionXmlSerializationReader.GetDefaultConstructor(System.Type)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<property name="Target">M:System.Xml.Xsl.Runtime.XmlExtensionFunction.CanBind</property>
</attribute>
</assembly>
-</linker>
\ No newline at end of file
+</linker>
return obj;
}
- private ConstructorInfo? GetDefaultConstructor(Type type)
- {
- if (type.IsValueType)
- return null;
-
- ConstructorInfo? ctor = FindDefaultConstructor(type.GetTypeInfo());
- return ctor;
- }
-
- private static ConstructorInfo? FindDefaultConstructor(TypeInfo ti)
- {
- foreach (ConstructorInfo ci in ti.DeclaredConstructors)
- {
- if (!ci.IsStatic && ci.GetParameters().Length == 0)
- {
- return ci;
- }
- }
-
- return null;
- }
+ private ConstructorInfo? GetDefaultConstructor(Type type) =>
+ type.IsValueType ? null :
+ type.GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, Type.EmptyTypes, null);
private object? WriteEncodedStructMethod(StructMapping structMapping)
{
if (m.CheckShouldPersist)
{
string methodInvoke = "ShouldSerialize" + m.Name;
- MethodInfo method = o!.GetType().GetTypeInfo().GetDeclaredMethod(methodInvoke)!;
+ MethodInfo method = o!.GetType().GetMethod(methodInvoke, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)!;
shouldPersist = (bool)method.Invoke(o, Array.Empty<object>())!;
}
if (m.CheckShouldPersist)
{
string methodInvoke = "ShouldSerialize" + m.Name;
- MethodInfo method = o!.GetType().GetTypeInfo().GetDeclaredMethod(methodInvoke)!;
+ MethodInfo method = o!.GetType().GetMethod(methodInvoke, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)!;
shouldPersist = (bool)method.Invoke(o, Array.Empty<object>())!;
}
throw new ArgumentNullException(nameof(rule));
}
- if (!this.AccessRuleType.GetTypeInfo().IsAssignableFrom(rule.GetType().GetTypeInfo()))
+ if (!this.AccessRuleType.IsAssignableFrom(rule.GetType()))
{
throw new ArgumentException(
SR.AccessControl_InvalidAccessRuleType,
throw new ArgumentNullException(nameof(rule));
}
- if (!this.AuditRuleType.GetTypeInfo().IsAssignableFrom(rule.GetType().GetTypeInfo()))
+ if (!this.AuditRuleType.IsAssignableFrom(rule.GetType()))
{
throw new ArgumentException(
SR.AccessControl_InvalidAuditRuleType,
// Target type must be a subclass of IdentityReference
//
- if (!targetType.GetTypeInfo().IsSubclassOf(typeof(IdentityReference)))
+ if (!targetType.IsSubclassOf(typeof(IdentityReference)))
{
throw new ArgumentException(SR.IdentityReference_MustBeIdentityReference, nameof(targetType));
}
// NOTE: We must reflect on a public type that is exposed in the contract here
// (i.e. CodePagesEncodingProvider), otherwise we will not get a reference to
// the right assembly.
- Stream? stream = typeof(CodePagesEncodingProvider).GetTypeInfo().Assembly.GetManifestResourceStream(tableName);
+ Stream? stream = typeof(CodePagesEncodingProvider).Assembly.GetManifestResourceStream(tableName);
if (stream == null)
{