<Compile Include="$(BclSourcesRoot)\System\Reflection\AmbiguousMatchException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyContentType.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyName.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyNameFlags.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Associates.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\DefaultMemberAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\EventAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClause.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClauseOptions.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\GenericParameterAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\INVOCATION_FLAGS.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\IReflect.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\LocalVariableInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ManifestResourceInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdConstant.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdFieldInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ParameterModifier.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Pointer.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\PortableExecutableKinds.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ProcessorArchitecture.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\PropertyAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionContext.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionTypeLoadException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ResourceAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ResourceLocation.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RtFieldInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeConstructorInfo.cs" />
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// AmbiguousMatchException is thrown when binding to a method results in more
-//
-// than one method matching the binding criteria. This exception is thrown in
-// general when something is Ambiguous.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
[Serializable]
public sealed class AmbiguousMatchException : SystemException
{
- public AmbiguousMatchException()
- : base(SR.RFLCT_Ambiguous)
+ public AmbiguousMatchException() : base(SR.RFLCT_Ambiguous)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
- public AmbiguousMatchException(String message) : base(message)
+ public AmbiguousMatchException(string message) : base(message)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
- public AmbiguousMatchException(String message, Exception inner) : base(message, inner)
+ public AmbiguousMatchException(string message, Exception inner) : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
internal AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context)
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related custom attributes.
-**
-**
-=============================================================================*/
-
-
-using System;
using System.Configuration.Assemblies;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyCopyrightAttribute : Attribute
{
- private String m_copyright;
-
- public AssemblyCopyrightAttribute(String copyright)
+ public AssemblyCopyrightAttribute(string copyright)
{
- m_copyright = copyright;
+ Copyright = copyright;
}
- public String Copyright
- {
- get { return m_copyright; }
- }
+ public string Copyright { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyTrademarkAttribute : Attribute
{
- private String m_trademark;
-
- public AssemblyTrademarkAttribute(String trademark)
+ public AssemblyTrademarkAttribute(string trademark)
{
- m_trademark = trademark;
+ Trademark = trademark;
}
- public String Trademark
- {
- get { return m_trademark; }
- }
+ public string Trademark { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyProductAttribute : Attribute
{
- private String m_product;
-
- public AssemblyProductAttribute(String product)
+ public AssemblyProductAttribute(string product)
{
- m_product = product;
+ Product = product;
}
- public String Product
- {
- get { return m_product; }
- }
+ public string Product { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyCompanyAttribute : Attribute
{
- private String m_company;
-
- public AssemblyCompanyAttribute(String company)
+ public AssemblyCompanyAttribute(string company)
{
- m_company = company;
+ Company = company;
}
- public String Company
- {
- get { return m_company; }
- }
+ public string Company { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDescriptionAttribute : Attribute
{
- private String m_description;
-
- public AssemblyDescriptionAttribute(String description)
+ public AssemblyDescriptionAttribute(string description)
{
- m_description = description;
+ Description = description;
}
- public String Description
- {
- get { return m_description; }
- }
+ public string Description { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyTitleAttribute : Attribute
{
- private String m_title;
-
- public AssemblyTitleAttribute(String title)
+ public AssemblyTitleAttribute(string title)
{
- m_title = title;
+ Title = title;
}
- public String Title
- {
- get { return m_title; }
- }
+ public string Title { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyConfigurationAttribute : Attribute
{
- private String m_configuration;
-
- public AssemblyConfigurationAttribute(String configuration)
+ public AssemblyConfigurationAttribute(string configuration)
{
- m_configuration = configuration;
+ Configuration = configuration;
}
- public String Configuration
- {
- get { return m_configuration; }
- }
+ public string Configuration { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDefaultAliasAttribute : Attribute
{
- private String m_defaultAlias;
-
- public AssemblyDefaultAliasAttribute(String defaultAlias)
+ public AssemblyDefaultAliasAttribute(string defaultAlias)
{
- m_defaultAlias = defaultAlias;
+ DefaultAlias = defaultAlias;
}
- public String DefaultAlias
- {
- get { return m_defaultAlias; }
- }
+ public string DefaultAlias { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyInformationalVersionAttribute : Attribute
{
- private String m_informationalVersion;
-
- public AssemblyInformationalVersionAttribute(String informationalVersion)
+ public AssemblyInformationalVersionAttribute(string informationalVersion)
{
- m_informationalVersion = informationalVersion;
+ InformationalVersion = informationalVersion;
}
- public String InformationalVersion
- {
- get { return m_informationalVersion; }
- }
+ public string InformationalVersion { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyFileVersionAttribute : Attribute
{
- private String _version;
-
- public AssemblyFileVersionAttribute(String version)
+ public AssemblyFileVersionAttribute(string version)
{
if (version == null)
throw new ArgumentNullException(nameof(version));
- Contract.EndContractBlock();
- _version = version;
+ Version = version;
}
- public String Version
- {
- get { return _version; }
- }
+ public string Version { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyCultureAttribute : Attribute
{
- private String m_culture;
-
- public AssemblyCultureAttribute(String culture)
+ public AssemblyCultureAttribute(string culture)
{
- m_culture = culture;
+ Culture = culture;
}
- public String Culture
- {
- get { return m_culture; }
- }
+ public string Culture { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyVersionAttribute : Attribute
{
- private String m_version;
-
- public AssemblyVersionAttribute(String version)
+ public AssemblyVersionAttribute(string version)
{
- m_version = version;
+ Version = version;
}
- public String Version
- {
- get { return m_version; }
- }
+ public string Version { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyKeyFileAttribute : Attribute
{
- private String m_keyFile;
-
- public AssemblyKeyFileAttribute(String keyFile)
+ public AssemblyKeyFileAttribute(string keyFile)
{
- m_keyFile = keyFile;
+ KeyFile = keyFile;
}
- public String KeyFile
- {
- get { return m_keyFile; }
- }
+ public string KeyFile { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDelaySignAttribute : Attribute
{
- private bool m_delaySign;
-
public AssemblyDelaySignAttribute(bool delaySign)
{
- m_delaySign = delaySign;
+ DelaySign = delaySign;
}
- public bool DelaySign
- {
- get
- { return m_delaySign; }
- }
+ public bool DelaySign { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyAlgorithmIdAttribute : Attribute
{
- private uint m_algId;
-
public AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm algorithmId)
{
- m_algId = (uint)algorithmId;
+ AlgorithmId = (uint)algorithmId;
}
[CLSCompliant(false)]
public AssemblyAlgorithmIdAttribute(uint algorithmId)
{
- m_algId = algorithmId;
+ AlgorithmId = algorithmId;
}
[CLSCompliant(false)]
- public uint AlgorithmId
- {
- get { return m_algId; }
- }
+ public uint AlgorithmId { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyFlagsAttribute : Attribute
{
- private AssemblyNameFlags m_flags;
+ private AssemblyNameFlags _flags;
[Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[CLSCompliant(false)]
public AssemblyFlagsAttribute(uint flags)
{
- m_flags = (AssemblyNameFlags)flags;
+ _flags = (AssemblyNameFlags)flags;
}
[Obsolete("This property has been deprecated. Please use AssemblyFlags instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[CLSCompliant(false)]
public uint Flags
{
- get { return (uint)m_flags; }
+ get { return (uint)_flags; }
}
- // This, of course, should be typed as AssemblyNameFlags. The compat police don't allow such changes.
public int AssemblyFlags
{
- get { return (int)m_flags; }
+ get { return (int)_flags; }
}
[Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public AssemblyFlagsAttribute(int assemblyFlags)
{
- m_flags = (AssemblyNameFlags)assemblyFlags;
+ _flags = (AssemblyNameFlags)assemblyFlags;
}
-
public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags)
{
- m_flags = assemblyFlags;
+ _flags = assemblyFlags;
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class AssemblyMetadataAttribute : Attribute
{
- private String m_key;
- private String m_value;
-
public AssemblyMetadataAttribute(string key, string value)
{
- m_key = key;
- m_value = value;
+ Key = key;
+ Value = value;
}
- public string Key
- {
- get { return m_key; }
- }
+ public string Key { get; }
- public string Value
- {
- get { return m_value; }
- }
+ public string Value { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public sealed class AssemblySignatureKeyAttribute : Attribute
{
- private String _publicKey;
- private String _countersignature;
-
- public AssemblySignatureKeyAttribute(String publicKey, String countersignature)
+ public AssemblySignatureKeyAttribute(string publicKey, string countersignature)
{
- _publicKey = publicKey;
- _countersignature = countersignature;
+ PublicKey = publicKey;
+ Countersignature = countersignature;
}
- public String PublicKey
- {
- get { return _publicKey; }
- }
+ public string PublicKey { get; }
- public String Countersignature
- {
- get { return _countersignature; }
- }
+ public string Countersignature { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyKeyNameAttribute : Attribute
{
- private String m_keyName;
-
- public AssemblyKeyNameAttribute(String keyName)
+ public AssemblyKeyNameAttribute(string keyName)
{
- m_keyName = keyName;
+ KeyName = keyName;
}
- public String KeyName
- {
- get { return m_keyName; }
- }
+ public string KeyName { get; }
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public enum AssemblyContentType
+ {
+ Default = 0,
+ WindowsRuntime = 1,
+ }
+}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-**
-** Purpose: Flags controlling how an AssemblyName is used
-** during binding
-**
-**
-===========================================================*/
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
- [FlagsAttribute()]
+ [Flags]
public enum AssemblyNameFlags
{
None = 0x0000,
Retargetable = 0x0100,
//ContentType = 0x0E00, // Bits describing the ContentType are accessible via AssemblyName.ContentType
}
-
- [Serializable]
- public enum AssemblyContentType
- {
- Default = 0x0000,
- WindowsRuntime = 0x0001
- }
-
- [Serializable]
- public enum ProcessorArchitecture
- {
- None = 0x0000,
- MSIL = 0x0001,
- X86 = 0x0002,
- IA64 = 0x0003,
- Amd64 = 0x0004,
- Arm = 0x0005
- }
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// This interface defines a set of methods which interact with reflection
-// during the binding process. This control allows systems to apply language
-// specific semantics to the binding and invocation process.
-//
-//
+using System.Globalization;
namespace System.Reflection
{
- using System;
- using System.Runtime.InteropServices;
- using CultureInfo = System.Globalization.CultureInfo;
-
- [Serializable]
public abstract class Binder
{
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref Object[] args,
- ParameterModifier[] modifiers, CultureInfo culture, String[] names, out Object state);
-
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match,
- Object value, CultureInfo culture);
-
- // Given a set of methods that match the base criteria, select a method based
- // upon an array of types. This method should return null if no method matchs
- // the criteria.
- public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match,
- Type[] types, ParameterModifier[] modifiers);
-
-
- // Given a set of propreties that match the base criteria, select one.
- public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match,
- Type returnType, Type[] indexes, ParameterModifier[] modifiers);
-
- // ChangeType
- // This method will convert the value into the property type.
- // It throws a cast exception if this fails.
- public abstract Object ChangeType(Object value, Type type, CultureInfo culture);
-
- public abstract void ReorderArgumentArray(ref Object[] args, Object state);
+ protected Binder() { }
+ public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
+ public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
+ public abstract object ChangeType(object value, Type type, CultureInfo culture);
+ public abstract void ReorderArgumentArray(ref object[] args, object state);
+ public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
+ public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// BindingFlags are a set of flags that control the binding and invocation process
-//
-// in Reflection. There are two processes. The first is selection of a Member which
-// is the binding phase. The second, is invocation. These flags control how this
-// process works.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum BindingFlags
{
Default = 0x00,
// These flags indicate what to search for when binding
- IgnoreCase = 0x01, // Ignore the case of Names while searching
+ IgnoreCase = 0x01, // Ignore the case of Names while searching
DeclaredOnly = 0x02, // Only look at the members declared on the Type
- Instance = 0x04, // Include Instance members in search
- Static = 0x08, // Include Static members in search
- Public = 0x10, // Include Public members in search
- NonPublic = 0x20, // Include Non-Public members in search
- FlattenHierarchy = 0x40, // Rollup the statics into the class.
+ Instance = 0x04, // Include Instance members in search
+ Static = 0x08, // Include Static members in search
+ Public = 0x10, // Include Public members in search
+ NonPublic = 0x20, // Include Non-Public members in search
+ FlattenHierarchy = 0x40, // Rollup the statics into the class.
// These flags are used by InvokeMember to determine
// what type of member we are trying to Invoke.
PutDispProperty = 0x4000,
PutRefDispProperty = 0x8000,
- ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
+ ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
SuppressChangeType = 0x020000,
// DefaultValueBinding will return the set of methods having ArgCount or
OptionalParamBinding = 0x040000,
// These are a couple of misc attributes used
- IgnoreReturn = 0x01000000, // This is used in COM Interop
+ IgnoreReturn = 0x01000000, // This is used in COM Interop
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CallingConventions is a set of Bits representing the calling conventions
-//
-// in the system.
-//
-//
-
-using System.Runtime.InteropServices;
-using System;
+// CallingConventions is a set of Bits representing the calling conventions in the system.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum CallingConventions
{
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CustomAttributeFormatException is thrown when the binary format of a
-//
-// custom attribute is invalid.
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using ApplicationException = System.ApplicationException;
- using System.Runtime.Serialization;
[Serializable]
public class CustomAttributeFormatException : FormatException
{
public CustomAttributeFormatException()
- : base(SR.Arg_CustomAttributeFormatException)
+ : this(SR.Arg_CustomAttributeFormatException)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
}
- public CustomAttributeFormatException(String message) : base(message)
+ public CustomAttributeFormatException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
}
- public CustomAttributeFormatException(String message, Exception inner) : base(message, inner)
+ public CustomAttributeFormatException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
+ HResult = __HResults.COR_E_CUSTOMATTRIBUTEFORMAT;
}
- protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// DefaultMemberAttribute is defines the Member of a Type that is the "default"
-//
-// member used by Type.InvokeMember. The default member is simply a name given
-// to a type.
-//
-//
-//
-//
-
-using System;
-
namespace System.Reflection
{
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
public sealed class DefaultMemberAttribute : Attribute
{
- // The name of the member
- private String m_memberName;
-
// You must provide the name of the member, this is required
- public DefaultMemberAttribute(String memberName)
+ public DefaultMemberAttribute(string memberName)
{
- m_memberName = memberName;
+ MemberName = memberName;
}
// A get accessor to return the name from the attribute.
// NOTE: There is no setter because the name must be provided
// to the constructor. The name is not optional.
- public String MemberName
- {
- get { return m_memberName; }
- }
+ public string MemberName { get; }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// EventAttributes are an enum defining the attributes associated with
-//
-// and Event. These are defined in CorHdr.h and are a combination of
-// bits and enums.
-//
-//
-
-using System;
+// EventAttributes are an enum defining the attributes associated with and Event.
+// These are defined in CorHdr.h and are a combination of bits and enums.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum EventAttributes
{
// This Enum matchs the CorEventAttr defined in CorHdr.h
SpecialName = 0x0200, // event is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0x0400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+
+ ReservedMask = 0x0400,
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Diagnostics.Contracts;
+
+namespace System.Reflection
+{
+ public class ExceptionHandlingClause
+ {
+ #region costructor
+ // This class can only be created from inside the EE.
+ protected ExceptionHandlingClause() { }
+ #endregion
+
+ #region Private Data Members
+ private MethodBody m_methodBody;
+ [ContractPublicPropertyName("Flags")]
+ private ExceptionHandlingClauseOptions m_flags;
+ private int m_tryOffset;
+ private int m_tryLength;
+ private int m_handlerOffset;
+ private int m_handlerLength;
+ private int m_catchMetadataToken;
+ private int m_filterOffset;
+ #endregion
+
+ #region Public Members
+ public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
+ public virtual int TryOffset { get { return m_tryOffset; } }
+ public virtual int TryLength { get { return m_tryLength; } }
+ public virtual int HandlerOffset { get { return m_handlerOffset; } }
+ public virtual int HandlerLength { get { return m_handlerLength; } }
+
+ public virtual int FilterOffset
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Filter)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
+
+ return m_filterOffset;
+ }
+ }
+
+ public virtual Type CatchType
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Clause)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
+
+ Type type = null;
+
+ if (!MetadataToken.IsNullToken(m_catchMetadataToken))
+ {
+ Type declaringType = m_methodBody.m_methodBase.DeclaringType;
+ Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
+ type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
+ m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
+ }
+
+ return type;
+ }
+ }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ if (Flags == ExceptionHandlingClauseOptions.Clause)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
+ }
+
+ if (Flags == ExceptionHandlingClauseOptions.Filter)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
+ }
+
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
+ }
+ #endregion
+ }
+}
+
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ [Flags()]
+ public enum ExceptionHandlingClauseOptions : int
+ {
+ Clause = 0x0,
+ Filter = 0x1,
+ Finally = 0x2,
+ Fault = 0x4,
+ }
+}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-
namespace System.Reflection
{
// This Enum matchs the CorFieldAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum FieldAttributes
{
// member access mask - Use this mask to retrieve accessibility information.
// interop attributes
PinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
- // Reserved flags for runtime use only.
- ReservedMask = 0x9500,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasFieldMarshal = 0x1000, // Field has marshalling information.
HasDefault = 0x8000, // Field has default.
HasFieldRVA = 0x0100, // Field has RVA.
+
+ ReservedMask = 0x9500,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
namespace System.Reflection
{
- [Flags()]
+ [Flags]
public enum GenericParameterAttributes
{
None = 0x0000,
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ICustomAttributeProvider is an interface that is implemented by reflection
-//
-// objects which support custom attributes.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- // Interface does not need to be marked with the serializable attribute
public interface ICustomAttributeProvider
{
- // Return an array of custom attributes identified by Type
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
-
-
- // Return an array of all of the custom attributes (named attributes are not included)
- Object[] GetCustomAttributes(bool inherit);
-
-
- // Returns true if one or more instance of attributeType is defined on this member.
+ object[] GetCustomAttributes(bool inherit);
+ object[] GetCustomAttributes(Type attributeType, bool inherit);
bool IsDefined(Type attributeType, bool inherit);
}
-}
+}
\ No newline at end of file
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// IReflectableType is an interface that is implemented by a Type produced
-// by a ReflectionContext
-//
-
-//
-
-using System;
-
namespace System.Reflection
{
public interface IReflectableType
TypeInfo GetTypeInfo();
}
}
+
namespace System.Reflection
{
- [Serializable]
public enum ImageFileMachine
{
I386 = 0x014c,
ARM = 0x01c4,
}
}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// Interface Map. This struct returns the mapping of an interface into the actual methods on a class
-// that implement that interface.
-//
-//
-
-using System;
-
namespace System.Reflection
{
public struct InterfaceMapping
{
- public Type TargetType; // The type implementing the interface
- public Type InterfaceType; // The type representing the interface
- public MethodInfo[] TargetMethods; // The methods implementing the interface
- public MethodInfo[] InterfaceMethods; // The methods defined on the interface
+ public Type TargetType; // The type implementing the interface
+ public Type InterfaceType; // The type representing the interface
+ public MethodInfo[] TargetMethods; // The methods implementing the interface
+ public MethodInfo[] InterfaceMethods; // The methods defined on the interface
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: Get the underlying TypeInfo from a Type
-**
-**
-=============================================================================*/
+using System.Diagnostics;
namespace System.Reflection
{
{
public static TypeInfo GetTypeInfo(this Type type)
{
+ IReflectableType reflectableType = type as IReflectableType;
+ if (reflectableType != null)
+ return reflectableType.GetTypeInfo();
+
if (type == null)
throw new ArgumentNullException(nameof(type));
- var rcType = (IReflectableType)type;
- return rcType.GetTypeInfo();
+ // This is bizarre but compatible with the desktop which casts "type" to IReflectableType without checking and
+ // thus, throws an InvalidCastException.
+ object ignore = (IReflectableType)type;
+ Debug.Fail("Did not expect to get here.");
+ throw new InvalidOperationException();
}
}
}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// InvalidFilterCriteriaException is thrown in FindMembers when the
-//
-// filter criteria is not valid for the type of filter being used.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using System.Runtime.Serialization;
- using ApplicationException = System.ApplicationException;
[Serializable]
public class InvalidFilterCriteriaException : ApplicationException
{
public InvalidFilterCriteriaException()
- : base(SR.Arg_InvalidFilterCriteriaException)
+ : this(SR.Arg_InvalidFilterCriteriaException)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
}
- public InvalidFilterCriteriaException(String message) : base(message)
+ public InvalidFilterCriteriaException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
}
- public InvalidFilterCriteriaException(String message, Exception inner) : base(message, inner)
+ public InvalidFilterCriteriaException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
+ HResult = __HResults.COR_E_INVALIDFILTERCRITERIA;
}
- protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public class LocalVariableInfo
+ {
+ #region Private Data Members
+ private RuntimeType m_type;
+ private int m_isPinned;
+ private int m_localIndex;
+ #endregion
+
+ #region Constructor
+ protected LocalVariableInfo() { }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ string toString = LocalType.ToString() + " (" + LocalIndex + ")";
+
+ if (IsPinned)
+ toString += " (pinned)";
+
+ return toString;
+ }
+ #endregion
+
+ #region Public Members
+ public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
+ public virtual bool IsPinned { get { return m_isPinned != 0; } }
+ public virtual int LocalIndex { get { return m_localIndex; } }
+ #endregion
+ }
+}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For info regarding a manifest resource's topology.
-**
-**
-=============================================================================*/
-
-using System;
-
namespace System.Reflection
{
public class ManifestResourceInfo
{
- private Assembly _containingAssembly;
- private String _containingFileName;
- private ResourceLocation _resourceLocation;
-
public ManifestResourceInfo(Assembly containingAssembly,
- String containingFileName,
+ string containingFileName,
ResourceLocation resourceLocation)
{
- _containingAssembly = containingAssembly;
- _containingFileName = containingFileName;
- _resourceLocation = resourceLocation;
- }
-
- public virtual Assembly ReferencedAssembly
- {
- get
- {
- return _containingAssembly;
- }
+ ReferencedAssembly = containingAssembly;
+ FileName = containingFileName;
+ ResourceLocation = resourceLocation;
}
- public virtual String FileName
- {
- get
- {
- return _containingFileName;
- }
- }
-
- public virtual ResourceLocation ResourceLocation
- {
- get
- {
- return _resourceLocation;
- }
- }
- }
-
- // The ResourceLocation is a combination of these flags, set or not.
- // Linked means not Embedded.
- [Serializable]
- [Flags]
- public enum ResourceLocation
- {
- Embedded = 0x1,
- ContainedInAnotherAssembly = 0x2,
- ContainedInManifestFile = 0x4
+ public virtual Assembly ReferencedAssembly { get; }
+ public virtual string FileName { get; }
+ public virtual ResourceLocation ResourceLocation { get; }
}
}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberFilter is a delegate used to filter Members. This delegate is used
-//
-// as a callback from Type.FindMembers.
-//
-//
-
namespace System.Reflection
{
- // Define the delegate
- [Serializable]
- public delegate bool MemberFilter(MemberInfo m, Object filterCriteria);
-}
+ public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
+}
\ No newline at end of file
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberTypes is an bit mask marking each type of Member that is defined as
-//
-// a subclass of MemberInfo. These are returned by MemberInfo.MemberType and
-// are useful in switch statements.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- // This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum MemberTypes
{
- // The following are the known classes which extend MemberInfo
Constructor = 0x01,
Event = 0x02,
Field = 0x04,
NestedType = 0x80,
All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType,
}
-}
+}
\ No newline at end of file
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum MethodAttributes
{
UnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code.
RTSpecialName = 0x1000, // Runtime should check name encoding.
- // Reserved flags for runtime use only.
- ReservedMask = 0xd000,
HasSecurity = 0x4000, // Method has security associate with it.
RequireSecObject = 0x8000, // Method calls another method containing security code.
+
+ ReservedMask = 0xd000,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Globalization;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- [Flags()]
- public enum ExceptionHandlingClauseOptions : int
- {
- Clause = 0x0,
- Filter = 0x1,
- Finally = 0x2,
- Fault = 0x4,
- }
-
- public class ExceptionHandlingClause
- {
- #region costructor
- // This class can only be created from inside the EE.
- protected ExceptionHandlingClause() { }
- #endregion
-
- #region Private Data Members
- private MethodBody m_methodBody;
- [ContractPublicPropertyName("Flags")]
- private ExceptionHandlingClauseOptions m_flags;
- private int m_tryOffset;
- private int m_tryLength;
- private int m_handlerOffset;
- private int m_handlerLength;
- private int m_catchMetadataToken;
- private int m_filterOffset;
- #endregion
-
- #region Public Members
- public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
- public virtual int TryOffset { get { return m_tryOffset; } }
- public virtual int TryLength { get { return m_tryLength; } }
- public virtual int HandlerOffset { get { return m_handlerOffset; } }
- public virtual int HandlerLength { get { return m_handlerLength; } }
-
- public virtual int FilterOffset
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Filter)
- throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
-
- return m_filterOffset;
- }
- }
-
- public virtual Type CatchType
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Clause)
- throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
-
- Type type = null;
-
- if (!MetadataToken.IsNullToken(m_catchMetadataToken))
- {
- Type declaringType = m_methodBody.m_methodBase.DeclaringType;
- Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
- type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
- m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
- }
-
- return type;
- }
- }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- if (Flags == ExceptionHandlingClauseOptions.Clause)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
- }
-
- if (Flags == ExceptionHandlingClauseOptions.Filter)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
- }
-
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
- }
- #endregion
- }
-
public class MethodBody
{
#region costructor
public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses { get { return Array.AsReadOnly(m_exceptionHandlingClauses); } }
#endregion
}
-
- public class LocalVariableInfo
- {
- #region Private Data Members
- private RuntimeType m_type;
- private int m_isPinned;
- private int m_localIndex;
- #endregion
-
- #region Constructor
- protected LocalVariableInfo() { }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- string toString = LocalType.ToString() + " (" + LocalIndex + ")";
-
- if (IsPinned)
- toString += " (pinned)";
-
- return toString;
- }
- #endregion
-
- #region Public Members
- public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
- public virtual bool IsPinned { get { return m_isPinned != 0; } }
- public virtual int LocalIndex { get { return m_localIndex; } }
- #endregion
- }
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-
-using System;
-
namespace System.Reflection
{
// This Enum matchs the CorMethodImpl defined in CorHdr.h
- [Serializable]
public enum MethodImplAttributes
{
// code impl mask
AggressiveInlining = 0x0100, // Method should be inlined if possible.
NoOptimization = 0x0040, // Method may not be optimized.
- MaxMethodImplVal = 0xFFFF, // Range check value
+ MaxMethodImplVal = 0xffff,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.Remoting;
using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- // This is not serializable because it is a reflection command.
[Serializable]
public sealed class Missing : ISerializable
{
public static readonly Missing Value = new Missing();
- #region Constructor
private Missing() { }
- #endregion
- #region ISerializable
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
UnitySerializationHolder.GetUnitySerializationInfo(info, this);
}
- #endregion
}
}
namespace System.Reflection
{
- [Serializable]
- public delegate Module ModuleResolveEventHandler(Object sender, ResolveEventArgs e);
+ public delegate Module ModuleResolveEventHandler(object sender, ResolveEventArgs e);
}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// ParameterAttributes is an enum defining the attributes that may be
-//
-// associated with a Parameter. These are defined in CorHdr.h.
-//
-//
-
-using System;
+// associated with a Parameter. These are defined in CorHdr.h.
namespace System.Reflection
{
// This Enum matchs the CorParamAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum ParameterAttributes
{
In = 0x0001, // Param is [In]
Out = 0x0002, // Param is [Out]
Lcid = 0x0004, // Param is [lcid]
- Retval = 0x0008, // Param is [Retval]
+
+ Retval = 0x0008, // Param is [Retval]
Optional = 0x0010, // Param is optional
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf000,
HasDefault = 0x1000, // Param has default value.
HasFieldMarshal = 0x2000, // Param has FieldMarshal.
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf000,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Diagnostics.Contracts;
-using System;
-
namespace System.Reflection
{
[Serializable]
public struct ParameterModifier
{
- #region Private Data Members
- private bool[] _byRef;
- #endregion
-
- #region Constructor
public ParameterModifier(int parameterCount)
{
if (parameterCount <= 0)
throw new ArgumentException(SR.Arg_ParmArraySize);
- Contract.EndContractBlock();
- _byRef = new bool[parameterCount];
+ IsByRefArray = new bool[parameterCount];
}
- #endregion
- #region Internal Members
- internal bool[] IsByRefArray { get { return _byRef; } }
- #endregion
-
- #region Public Members
public bool this[int index]
{
get
{
- return _byRef[index];
+ return IsByRefArray[index];
}
set
{
- _byRef[index] = value;
+ IsByRefArray[index] = value;
}
}
- #endregion
+
+ internal bool[] IsByRefArray { get; }
}
}
namespace System.Reflection
{
[Flags]
- [Serializable]
public enum PortableExecutableKinds
{
NotAPortableExecutableImage = 0x0,
Preferred32Bit = 0x10,
}
}
+
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public enum ProcessorArchitecture
+ {
+ None = 0x0000,
+ MSIL = 0x0001,
+ X86 = 0x0002,
+ IA64 = 0x0003,
+ Amd64 = 0x0004,
+ Arm = 0x0005
+ }
+}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// PropertyAttributes is an enum which defines the attributes that may be associated
-//
-// with a property. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
+// with a property. The values here are defined in Corhdr.h.
namespace System.Reflection
{
// This Enum matchs the CorPropertyAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum PropertyAttributes
{
None = 0x0000,
SpecialName = 0x0200, // property is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasDefault = 0x1000, // Property has default
- Reserved2 = 0x2000, // reserved bit
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved2 = 0x2000,
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf400,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related stuff.
-**
-**
-=============================================================================*/
-
-using System;
-
namespace System.Reflection
{
public abstract class ReflectionContext
}
}
}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ReflectionTypeLoadException is thrown when multiple TypeLoadExceptions may occur.
-//
-// Specifically, when you call Module.GetTypes() this causes multiple class loads to occur.
-// If there are failures, we continue to load classes and build an array of the successfully
-// loaded classes. We also build an array of the errors that occur. Then we throw this exception
-// which exposes both the array of classes and the array of TypeLoadExceptions.
-//
-//
-//
-//
-
-using System;
using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
[Serializable]
public sealed class ReflectionTypeLoadException : SystemException, ISerializable
{
- private Type[] _classes;
- private Exception[] _exceptions;
-
- // private constructor. This is not called.
- private ReflectionTypeLoadException()
- : base(SR.ReflectionTypeLoad_LoadFailed)
- {
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
- }
-
public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions) : base(null)
{
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
}
- public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, String message) : base(message)
+ public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, string message) : base(message)
{
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
}
internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context)
{
- _classes = (Type[])(info.GetValue("Types", typeof(Type[])));
- _exceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
- }
-
- public Type[] Types
- {
- get { return _classes; }
- }
-
- public Exception[] LoaderExceptions
- {
- get { return _exceptions; }
+ Types = (Type[])(info.GetValue("Types", typeof(Type[])));
+ LoaderExceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
}
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
- if (info == null)
- {
- throw new ArgumentNullException(nameof(info));
- }
- Contract.EndContractBlock();
base.GetObjectData(info, context);
- info.AddValue("Types", _classes, typeof(Type[]));
- info.AddValue("Exceptions", _exceptions, typeof(Exception[]));
+ info.AddValue("Types", Types, typeof(Type[]));
+ info.AddValue("Exceptions", LoaderExceptions, typeof(Exception[]));
}
+
+ public Type[] Types { get; }
+
+ public Exception[] LoaderExceptions { get; }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ResourceAttributes is an enum which defines the attributes that may be associated
-//
-// with a manifest resource. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum ResourceAttributes
{
Private = 0x0002,
}
}
+
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ [Flags]
+ public enum ResourceLocation
+ {
+ ContainedInAnotherAssembly = 2,
+ ContainedInManifestFile = 4,
+ Embedded = 1,
+ }
+}
+
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: Encapsulate access to a public/private key pair
-** used to sign strong name assemblies.
-**
-**
-===========================================================*/
-
-using System;
using System.IO;
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.InteropServices;
using System.Runtime.Serialization;
-using System.Security;
-using System.Runtime.Versioning;
-using Microsoft.Win32;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
{
private bool _keyPairExported;
private byte[] _keyPairArray;
- private String _keyPairContainer;
+ private string _keyPairContainer;
private byte[] _publicKey;
// Build key pair from file.
{
if (keyPairFile == null)
throw new ArgumentNullException(nameof(keyPairFile));
- Contract.EndContractBlock();
int length = (int)keyPairFile.Length;
_keyPairArray = new byte[length];
{
if (keyPairArray == null)
throw new ArgumentNullException(nameof(keyPairArray));
- Contract.EndContractBlock();
_keyPairArray = new byte[keyPairArray.Length];
Array.Copy(keyPairArray, _keyPairArray, keyPairArray.Length);
_publicKey = (byte[])info.GetValue("_publicKey", typeof(byte[]));
}
- public StrongNameKeyPair(String keyPairContainer)
+ public StrongNameKeyPair(string keyPairContainer)
{
throw new PlatformNotSupportedException();
}
}
}
- /// <internalonly/>
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("_keyPairExported", _keyPairExported);
info.AddValue("_publicKey", _publicKey);
}
- /// <internalonly/>
- void IDeserializationCallback.OnDeserialization(Object sender) { }
+ void IDeserializationCallback.OnDeserialization(object sender) { }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetException is thrown when the target to an Invoke is invalid. This may
-//
-// occur because the caller doesn't have access to the member, or the target doesn't
-// define the member, etc.
-//
-//
-//
-//
-
-using System;
using System.Runtime.Serialization;
namespace System.Reflection
[Serializable]
public class TargetException : ApplicationException
{
- public TargetException() : base()
+ public TargetException()
+ : this(null)
{
- SetErrorCode(__HResults.COR_E_TARGET);
}
- public TargetException(String message) : base(message)
+ public TargetException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_TARGET);
}
- public TargetException(String message, Exception inner) : base(message, inner)
+ public TargetException(string message, Exception inner) : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGET);
+ HResult = __HResults.COR_E_TARGET;
}
- protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetInvocationException is used to report an exception that was thrown
-//
-// by the target of an invocation.
-//
-//
-//
-//
-
-
-using System;
using System.Runtime.Serialization;
namespace System.Reflection
[Serializable]
public sealed class TargetInvocationException : ApplicationException
{
- // This exception is not creatable without specifying the
- // inner exception.
- private TargetInvocationException()
- : base(SR.Arg_TargetInvocationException)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- // This is called from within the runtime.
- private TargetInvocationException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- public TargetInvocationException(System.Exception inner)
+ public TargetInvocationException(Exception inner)
: base(SR.Arg_TargetInvocationException, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
+ HResult = __HResults.COR_E_TARGETINVOCATION;
}
- public TargetInvocationException(String message, Exception inner) : base(message, inner)
+ public TargetInvocationException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
+ HResult = __HResults.COR_E_TARGETINVOCATION;
}
- internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetParameterCountException is thrown when the number of parameter to an
-//
-// invocation doesn't match the number expected.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
[Serializable]
public sealed class TargetParameterCountException : ApplicationException
{
public TargetParameterCountException()
: base(SR.Arg_TargetParameterCountException)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- public TargetParameterCountException(String message)
+ public TargetParameterCountException(string message)
: base(message)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- public TargetParameterCountException(String message, Exception inner)
+ public TargetParameterCountException(string message, Exception inner)
: base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- internal TargetParameterCountException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ internal TargetParameterCountException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
-using System;
namespace System.Reflection
{
// This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum TypeAttributes
{
// Implementation attributes.
Import = 0x00001000, // Class / interface is imported
Serializable = 0x00002000, // The class is Serializable.
-
WindowsRuntime = 0x00004000, // Type is a Windows Runtime type.
// Use tdStringFormatMask to retrieve string information for native interop
BeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access.
- // Flags reserved for runtime use.
- ReservedMask = 0x00040800,
RTSpecialName = 0x00000800, // Runtime should check name encoding.
HasSecurity = 0x00040000, // Class has security associate with it.
+
+ ReservedMask = 0x00040800,
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TypeFilter defines a delegate that is as a callback function for filtering
-//
-// a list of Types.
-//
-//
-
namespace System.Reflection
{
- // Define the delegate
- [Serializable]
- public delegate bool TypeFilter(Type m, Object filterCriteria);
+ public delegate bool TypeFilter(Type m, object filterCriteria);
}