Caprices

MemberAttributes

メンバ

フィールド

Abstract
抽象メンバー
10進数
1
16進数
0001
2進数
0000 0000 0000 0001
Final
派生クラスでオーバーライドできないメンバー
10進数
2
16進数
0002
2進数
0000 0000 0000 0010
Static
静的メンバー このメンバーは、Visual Basic の Shared キーワードと等価です
10進数
3
16進数
0003
2進数
0000 0000 0000 0011
Override
基本クラス メンバーをオーバーライドするメンバー
10進数
4
16進数
0004
2進数
0000 0000 0000 0100
Const
定数メンバー
10進数
5
16進数
0005
2進数
0000 0000 0000 0101
ScopeMask
スコープ マスク
10進数
15
16進数
000F
2進数
0000 0000 0000 1111
New
新規メンバー
10進数
16
16進数
0010
2進数
0000 0000 0001 0000
VTableMask
VTable マスク
10進数
240
16進数
00F0
2進数
0000 0000 1111 0000
Overloaded
オーバーロードされたメンバー Visual Basic などの一部の言語では、オーバーロードされたメンバーを明示的に示す必要があります
10進数
256
16進数
0100
2進数
0000 0001 0000 0000
Assembly
同じアセンブリ内の任意のクラスにアクセスできるメンバー
10進数
4096
16進数
1000
2進数
0001 0000 0000 0000
FamilyAndAssembly
クラス内および同じアセンブリの派生クラスにアクセスできるメンバー
10進数
8192
16進数
2000
2進数
0010 0000 0000 0000
Family
クラスと派生クラスのファミリ内にアクセスできるメンバー
10進数
12288
16進数
3000
2進数
0011 0000 0000 0000
FamilyOrAssembly
クラス内、任意のアセンブリの派生クラス、および同じアセンブリの任意のクラスにアクセスできるメンバー
10進数
16384
16進数
4000
2進数
0100 0000 0000 0000
Private
プライベート メンバー
10進数
20480
16進数
5000
2進数
0101 0000 0000 0000
Public
パブリック メンバー
10進数
24576
16進数
6000
2進数
0110 0000 0000 0000
AccessMask
アクセス マスク
10進数
61440
16進数
F000
2進数
1111 0000 0000 0000

対応表

  未設定 AccessMask VTableMask ScopeMask
CodeConstructor private - - -
CodeEntryPointMethod public static public static public static public static
CodeMemberField private - - -
CodeMemberMethod private - - -
CodeMemberProperty private - - -
CodeTypeDeclaration public public new public public
  Public Private FamilyOrAssembly Family FamilyAndAssembly Assembly
CodeConstructor public private protected internal protected internal internal
CodeEntryPointMethod public static public static public static public static public static public static
CodeMemberField public private protected internal protected internal internal
CodeMemberMethod public virtual private protected internal protected virtual internal internal virtual
CodeMemberProperty public virtual private protected internal protected virtual internal internal virtual
CodeTypeDeclaration public public public public public public
  Overloaded
CodeConstructor -
CodeEntryPointMethod public static
CodeMemberField -
CodeMemberMethod -
CodeMemberProperty -
CodeTypeDeclaration public
  New
CodeConstructor -
CodeEntryPointMethod public static
CodeMemberField new
CodeMemberMethod new
CodeMemberProperty new
CodeTypeDeclaration new public
  Const Override Static Final Abstract
CodeConstructor - - - - -
CodeEntryPointMethod public static public static public static public static public static
CodeMemberField - - static - -
CodeMemberMethod - override static - abstract
CodeMemberProperty - override static - abstract
CodeTypeDeclaration public public public public public

▲ページ先頭へ

次のコード例の使用、CodeMemberPropertyを定義する、stringプロパティgetとsetアクセサー。


// Declares a property of type String named StringProperty.
CodeMemberProperty property1 = new CodeMemberProperty();
property1.Name = "StringProperty";
property1.Type = new CodeTypeReference("System.String");
property1.Attributes = MemberAttributes.Public;
property1.GetStatements.Add( new CodeMethodReturnStatement( new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "testStringField") ) );
property1.SetStatements.Add( new CodeAssignStatement( new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "testStringField"), new CodePropertySetValueReferenceExpression()));

// A C# code generator produces the following source code for the preceeding example code:

//       public virtual string StringProperty 
//       {
//              get 
//            {
//                return this.testStringField;
//            }
//            set 
//            {
//                this.testStringField = value;
//            }
//       }

▲ページ先頭へ

定義


[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum MemberAttributes

▲ページ先頭へ

クラス


#region アセンブリ System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:¥Program Files (x86)¥Reference Assemblies¥Microsoft¥Framework¥.NETFramework¥v4.6.1¥System.dll
#endregion

using System.Runtime.InteropServices;

namespace System.CodeDom
{
	//
	// 概要:
	//     クラスのメンバーのメンバー属性識別子を定義します。
	[ComVisible( true )]
	public enum MemberAttributes
	{
		//
		// 概要:
		//     抽象メンバーです。
		Abstract = 1,
		//
		// 概要:
		//     派生クラスでオーバーライドできないメンバー。
		Final = 2,
		//
		// 概要:
		//     静的メンバーです。 Visual basic の場合は、これは、 Shared キーワードです。
		Static = 3,
		//
		// 概要:
		//     基本クラスのメンバーをオーバーライドするメンバー。
		Override = 4,
		//
		// 概要:
		//     定数のメンバーです。
		Const = 5,
		//
		// 概要:
		//     スコープのマスク。
		ScopeMask = 15,
		//
		// 概要:
		//     新しいメンバーです。
		New = 16,
		//
		// 概要:
		//     VTable のマスク。
		VTableMask = 240,
		//
		// 概要:
		//     オーバー ロードされたメンバーの場合。 Visual Basic などの一部の言語では、オーバー ロードされたメンバーを明示的に指定する必要があります。
		Overloaded = 256,
		//
		// 概要:
		//     同じアセンブリ内の任意のクラスにアクセスできるメンバーです。
		Assembly = 4096,
		//
		// 概要:
		//     そのクラス、および同じアセンブリ内の派生クラス内でアクセス可能なメンバーです。
		FamilyAndAssembly = 8192,
		//
		// 概要:
		//     そのクラスと派生クラスのファミリ内でアクセス可能なメンバーです。
		Family = 12288,
		//
		// 概要:
		//     クラス、その派生クラスを任意のアセンブリ内および同じアセンブリ内のクラスからアクセスできるメンバー。
		FamilyOrAssembly = 16384,
		//
		// 概要:
		//     プライベート メンバー。
		Private = 20480,
		//
		// 概要:
		//     パブリック メンバーです。
		Public = 24576,
		//
		// 概要:
		//     アクセス マスク。
		AccessMask = 61440
	}
}

▲ページ先頭へ