//
#if MONO_FEATURE_SRE
-using System.Collections;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Reflection.Emit
if (other == null)
return Array.Empty<MethodInfo>();
- ArrayList ar = new ArrayList();
+ List<MethodInfo> res = new List<MethodInfo>();
foreach (MethodInfo method in other)
{
if (nonPublic || method.IsPublic)
- ar.Add(TypeBuilder.GetMethod(instantiation, method));
+ res.Add(TypeBuilder.GetMethod(instantiation, method));
}
- MethodInfo[] res = new MethodInfo[ar.Count];
- ar.CopyTo(res, 0);
- return res;
+ return res.ToArray();
}
public override Type DeclaringType
//
#if MONO_FEATURE_SRE
-using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
{
if (ctors == null)
return Array.Empty<ConstructorInfo>();
- ArrayList l = new ArrayList();
+ List<ConstructorInfo> result = new List<ConstructorInfo>();
bool match;
MethodAttributes mattrs;
}
if (!match)
continue;
- l.Add(c);
+ result.Add(c);
}
- ConstructorInfo[] result = new ConstructorInfo[l.Count];
- l.CopyTo(result);
- return result;
+ return result.ToArray();
}
public override Type GetElementType()
if (((bindingAttr & BindingFlags.DeclaredOnly) == 0) && (parent != null))
{
MethodInfo[] parent_methods = parent.GetMethods(bindingAttr);
- ArrayList parent_candidates = new ArrayList(parent_methods.Length);
+ List<MethodInfo> parent_candidates = new List<MethodInfo>(parent_methods.Length);
bool flatten = (bindingAttr & BindingFlags.FlattenHierarchy) != 0;
if (candidates == null)
return Array.Empty<MethodInfo>();
- ArrayList l = new ArrayList();
+ List<MethodInfo> result = new List<MethodInfo>();
foreach (MethodInfo c in candidates)
{
}
if (!match)
continue;
- l.Add(c);
+ result.Add(c);
}
-
- MethodInfo[] result = new MethodInfo[l.Count];
- l.CopyTo(result);
- return result;
+ return result.ToArray();
}
public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
throw new NotSupportedException();
bool match;
- ArrayList result = new ArrayList();
+ List<Type> result = new List<Type>();
if (subtypes == null)
return EmptyTypes;
continue;
result.Add(t);
}
- Type[] r = new Type[result.Count];
- result.CopyTo(r);
- return r;
+ return result.ToArray();
}
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
//
#if MONO_FEATURE_SRE
-using System.Collections;
+using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning restore 649
#endregion
- private Hashtable? fields, ctors, methods;
+ private Dictionary<FieldInfo, FieldInfo>? fields;
+ private Dictionary<ConstructorInfo, ConstructorInfo>? ctors;
+ private Dictionary<MethodInfo, MethodInfo>? methods;
internal TypeBuilderInstantiation()
{
internal override MethodInfo GetMethod(MethodInfo fromNoninstanciated)
{
if (methods == null)
- methods = new Hashtable();
+ methods = new Dictionary<MethodInfo, MethodInfo>();
if (!methods.ContainsKey(fromNoninstanciated))
methods[fromNoninstanciated] = new MethodOnTypeBuilderInst(this, fromNoninstanciated);
- return (MethodInfo)methods[fromNoninstanciated]!;
+ return methods[fromNoninstanciated]!;
}
internal override ConstructorInfo GetConstructor(ConstructorInfo fromNoninstanciated)
{
if (ctors == null)
- ctors = new Hashtable();
+ ctors = new Dictionary<ConstructorInfo, ConstructorInfo>();
if (!ctors.ContainsKey(fromNoninstanciated))
ctors[fromNoninstanciated] = new ConstructorOnTypeBuilderInst(this, fromNoninstanciated);
- return (ConstructorInfo)ctors[fromNoninstanciated]!;
+ return ctors[fromNoninstanciated]!;
}
internal override FieldInfo GetField(FieldInfo fromNoninstanciated)
{
if (fields == null)
- fields = new Hashtable();
+ fields = new Dictionary<FieldInfo, FieldInfo>();
if (!fields.ContainsKey(fromNoninstanciated))
fields[fromNoninstanciated] = new FieldOnTypeBuilderInst(this, fromNoninstanciated);
- return (FieldInfo)fields[fromNoninstanciated]!;
+ return fields[fromNoninstanciated]!;
}
public override MethodInfo[] GetMethods(BindingFlags bf)