IsSignUnspecifiedByte クラス
アセンブリ: mscorlib (mscorlib.dll 内)
![構文](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
![解説](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
一部のプログラミング言語 (C++ など) は、signed char、unsigned char、char という 3 つの異なる char 値を認識します。修飾されていない char 型を他から区別するため、Microsoft C++ コンパイラは、アセンブリに出力される各 char 型に IsSignUnspecifiedByte 修飾子を追加します。
既定の動作が適切でない場合、コンパイラはメタデータ内のカスタム修飾子を出力して、Just-In-Time (JIT) コンパイラによる値の処理方法を変更します。JIT コンパイラは、カスタム修飾子を見つけると、その修飾子の指定に従って値を処理します。コンパイラは、メソッド、パラメータ、および戻り値に対してカスタム修飾子を適用します。JIT コンパイラは、オプションの修飾子は無視できますが、必須の修飾子については応答する必要があります。
![使用例](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
System.Reflection.Emit 名前空間内のクラスを使用してアセンブリを作成し、そのアセンブリに IsSignUnspecifiedByte 修飾子を出力するコード例を次に示します。
#using <mscorlib.dll> using namespace System; using namespace System::Reflection; using namespace System::Reflection::Emit; using namespace System::Runtime::CompilerServices; using namespace System::Threading; ref class CodeEmitter { private: AssemblyBuilder^ asmBuilder; String^ asmName; ModuleBuilder^ modBuilder; void prepareAssembly(String^ name){ // Check the input. if(!name){ throw gcnew ArgumentNullException("AssemblyName"); } asmName = name; // Create an AssemblyName object and set the name. AssemblyName^ asmName = gcnew AssemblyName(); asmName->Name = name; // Use the AppDomain class to create an AssemblyBuilder instance. AppDomain^ currentDomain = Thread::GetDomain(); asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); // Create a dynamic module. modBuilder = asmBuilder->DefineDynamicModule(name); } public: // Constructor. CodeEmitter(String ^ AssemblyName){ prepareAssembly(AssemblyName); } // Create a new type. TypeBuilder^ CreateType(String^ name){ // Check the input. if(!name){ throw gcnew ArgumentNullException("AssemblyName"); } return modBuilder->DefineType( name ); } // Write the assembly. void WriteAssembly(MethodBuilder^ entryPoint){ // Check the input. if(!entryPoint){ throw gcnew ArgumentNullException("entryPoint"); } asmBuilder->SetEntryPoint( entryPoint ); asmBuilder->Save( asmName ); } }; void main() { // Create a CodeEmitter to handle assembly creation. CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); // Create a new type. TypeBuilder^ mainClass = e->CreateType("MainClass"); // Create a new method. MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); // Create an ILGenerator and emit IL for // a simple "Hello World." program. ILGenerator^ ilGen = mBuilder->GetILGenerator(); ilGen->Emit(OpCodes::Ldstr, "Hello World"); array<Type^>^mType = {String::typeid}; MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); ilGen->Emit( OpCodes::Ret ); ///////////////////////////////////////////////// ///////////////////////////////////////////////// // Apply a required custom modifier // to a field. ///////////////////////////////////////////////// ///////////////////////////////////////////////// array<Type^>^fType = {IsSignUnspecifiedByte::typeid}; mainClass->DefineField("modifiedInteger", Type::GetType("System.Byte"), fType, nullptr, FieldAttributes::Private); // Create the type. mainClass->CreateType(); // Write the assembly using a reference to // the entry point. e->WriteAssembly(mBuilder); Console::WriteLine(L"Assembly created."); }
![継承階層](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
System.Runtime.CompilerServices.IsSignUnspecifiedByte
![スレッド セーフ](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
![プラットフォーム](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
![バージョン情報](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
![参照](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
- IsSignUnspecifiedByte クラスのページへのリンク