私は参照アセンブリを介してビットを検索し、奇妙なコメント/スニペットに気づいた:モジュールをどのようにターゲットに設定できますか?
// Attribute class used by the compiler to mark modules.
// If present, then debugging information for everything in the
// assembly was generated by the compiler, and will be preserved
// by the Runtime so that the debugger can provide full functionality
// in the case of JIT attach. If not present, then the compiler may
// or may not have included debugging information, and the Runtime
// won't preserve the debugging info, which will make debugging after
// a JIT attach difficult.
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Module, AllowMultiple = false)]
[ComVisible(true)]
public sealed class DebuggableAttribute : Attribute
{
は今、私はAttributeTargets
上に飛び乗ったとモジュールは、C#の/であると思いましNET。
[Flags]
[ComVisible(true)]
[__DynamicallyInvokable]
[Serializable]
public enum AttributeTargets
{
[__DynamicallyInvokable] Assembly = 1,
[__DynamicallyInvokable] Module = 2,
[__DynamicallyInvokable] Class = 4,
[__DynamicallyInvokable] Struct = 8,
[__DynamicallyInvokable] Enum = 16,
[__DynamicallyInvokable] Constructor = 32,
[__DynamicallyInvokable] Method = 64,
[__DynamicallyInvokable] Property = 128,
[__DynamicallyInvokable] Field = 256,
[__DynamicallyInvokable] Event = 512,
[__DynamicallyInvokable] Interface = 1024,
[__DynamicallyInvokable] Parameter = 2048,
[__DynamicallyInvokable] Delegate = 4096,
[__DynamicallyInvokable] ReturnValue = 8192,
[__DynamicallyInvokable] GenericParameter = 16384,
[__DynamicallyInvokable] All = GenericParameter | ReturnValue | Delegate | Parameter | Interface | Event | Field | Property | Method | Constructor | Enum | Struct | Class | Module | Assembly,
}
私の質問は、どのように属性を持つC#コードからモジュールをターゲットできますか?
この属性は、コンパイラによって既に生成されています。それを間違って書いてはいけません。*非常に有害な副作用があります。 –
@HansPassant大丈夫 – Mafii