CodeAccessSecurityAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Constructor Or AttributeTargets.Method, AllowMultiple:=True, Inherited:=False)> _ Public MustInherit Class CodeAccessSecurityAttribute Inherits SecurityAttribute
[SerializableAttribute] [ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false)] public abstract class CodeAccessSecurityAttribute : SecurityAttribute
[SerializableAttribute] [ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Constructor|AttributeTargets::Method, AllowMultiple=true, Inherited=false)] public ref class CodeAccessSecurityAttribute abstract : public SecurityAttribute
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ /** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false) */ public abstract class CodeAccessSecurityAttribute extends SecurityAttribute
SerializableAttribute ComVisibleAttribute(true) AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false) public abstract class CodeAccessSecurityAttribute extends SecurityAttribute

この属性クラスは、Demand などの SecurityAction をカスタム セキュリティ属性に関連付けます。
CodeAccessSecurityAttribute から派生する型は、リソースやセキュリティ設定可能な操作へのアクセスを制限するために使用されます。
セキュリティ属性によって宣言されたセキュリティ情報は、属性ターゲットのメタデータに格納され、実行時にシステムによってアクセスされます。セキュリティ属性は宣言セキュリティにだけ使用されます。強制セキュリティの場合は、CodeAccessPermission から派生した、対応するアクセス許可クラスを使用します。
継承時の注意 このクラスから派生させるアクセス許可属性にはすべて、SecurityAction を唯一のパラメータとして受け取るコンストラクタを必ず 1 つだけ定義してください。
CodeAccessSecurityAttribute クラスから派生したアクセス許可属性の例を次に示します。
Imports System Imports System.IO Imports System.Runtime.Remoting Imports System.Security Imports System.Security.Permissions Imports System.Reflection Imports MyPermission Imports Microsoft.VisualBasic ' Use the command line option '/keyfile' or appropriate project settings to sign this assembly. <Assembly: System.Security.AllowPartiallyTrustedCallersAttribute()> Namespace MyPermissionAttribute <AttributeUsage(AttributeTargets.All, AllowMultiple:=True, Inherited:=False)> Public NotInheritable Class NameIdPermissionAttribute Inherits CodeAccessSecurityAttribute Private m_Name As String = Nothing Private m_unrestricted As Boolean = False Public Sub New(ByVal action As SecurityAction) MyBase.New(action) End Sub 'New Public Property Name() As String Get Return m_name End Get Set(ByVal Value As String) m_name = Value End Set End Property Public Overrides Function CreatePermission() As IPermission If m_unrestricted Then Throw New ArgumentException("Unrestricted permissions not allowed in identity permissions.") Else If m_name Is Nothing Then Return New NameIdPermission(PermissionState.None) End If Return New NameIdPermission(m_name) End If End Function 'CreatePermission End Class ' NameIdPermissionAttribute End Namespace
using System; using System.IO; using System.Runtime.Remoting; using System.Security; using System.Security.Permissions; using System.Reflection; using MyPermission; // Use the command line option '/keyfile' or appropriate project settings to sign this assembly. [assembly: System.Security.AllowPartiallyTrustedCallersAttribute ()] namespace MyPermissionAttribute { [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)] [Serializable] sealed public class NameIdPermissionAttribute : CodeAccessSecurityAttribute { private String m_Name = null; private bool m_unrestricted = false; public NameIdPermissionAttribute (SecurityAction action): base( action ) { } public String Name { get { return m_Name; } set { m_Name = value; } } public override IPermission CreatePermission () { if (m_unrestricted) { throw new ArgumentException ("Unrestricted permissions not allowed in identity permissions."); } else { if (m_Name == null) return new NameIdPermission (PermissionState.None); return new NameIdPermission (m_Name); } } } }

System.Attribute
System.Security.Permissions.SecurityAttribute
System.Security.Permissions.CodeAccessSecurityAttribute
派生クラス


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAccessSecurityAttribute コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)


このクラスのインスタンスは作成できません。このクラスの機能を利用するには、このクラスから継承する必要があります。
継承時の注意 派生クラスには、SecurityAction を唯一のパラメータとして受け取るコンストラクタを必ず 1 つだけ定義する必要があります。
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAccessSecurityAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | Action | セキュリティ アクションを取得または設定します。 ( SecurityAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Unrestricted | 属性によって保護されているリソースに対して完全な (無制限の) アクセス許可が宣言されているかどうかを示す値を取得または設定します。 ( SecurityAttribute から継承されます。) |

CodeAccessSecurityAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | CreatePermission | 派生クラス内でオーバーライドされるときに、後からバイナリ形式にシリアル化でき、SecurityAction と共にアセンブリのメタデータに永続的に格納できるアクセス許可オブジェクトを作成します。 ( SecurityAttribute から継承されます。) |
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

CodeAccessSecurityAttribute メンバ
コード アクセス セキュリティの基本属性クラスを指定します。
CodeAccessSecurityAttribute データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | CodeAccessSecurityAttribute | SecurityAction を指定して、CodeAccessSecurityAttribute の新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | Action | セキュリティ アクションを取得または設定します。(SecurityAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Unrestricted | 属性によって保護されているリソースに対して完全な (無制限の) アクセス許可が宣言されているかどうかを示す値を取得または設定します。(SecurityAttribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | CreatePermission | 派生クラス内でオーバーライドされるときに、後からバイナリ形式にシリアル化でき、SecurityAction と共にアセンブリのメタデータに永続的に格納できるアクセス許可オブジェクトを作成します。 (SecurityAttribute から継承されます。) |
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からCodeAccessSecurityAttributeを検索する場合は、下記のリンクをクリックしてください。

- CodeAccessSecurityAttributeのページへのリンク