_Type.IsPrimitive プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > _Type.IsPrimitive プロパティの意味・解説 

_Type.IsPrimitive プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、Type.IsPrimitive プロパティへのバージョン依存しないアクセス用意されています。

このプロパティは、CLS準拠していません。  

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As _Type
Dim value As Boolean

value = instance.IsPrimitive
bool IsPrimitive { get; }
property bool IsPrimitive {
    bool get ();
}
/** @property */
boolean get_IsPrimitive ()
function get IsPrimitive () : boolean

プロパティ
Typeプリミティブ型1 つである場合trueそれ以外場合false

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.IsPrimitive プロパティ

Typeプリミティブ型1 つかどうかを示す値を取得します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説

プリミティブ型には、BooleanByte、SByte、Int16、UInt16、Int32、UInt32、Int64、UInt64、CharDouble、および Singleあります

現在の Typeジェネリック型、またはジェネリック型またはジェネリック メソッドの定義の型パラメータ表している場合、このプロパティは常に false返します

使用例使用例

Type クラスIsContextful、IsMarshalByRef、IsPrimitive の各プロパティの例を次に示します。これは、指定された型がこのコンテキストホストできるかどうか参照によってマーシャリングできるかどうか指定された型がプリミティブ データ型かどうか確認します

Imports System
Imports System.Runtime.Remoting.Contexts
Imports Microsoft.VisualBasic
Public Class MyContextBoundClass
    Inherits ContextBoundObject
    Public myString As String
 = "This class demonstrates the IsContextful, IsMarshalByRef,
 and IsPrimitive properties."
End Class 'MyContextBoundClass
Public Class MyTypeDemoClass
    Public Shared Sub Main()
        Try
            ' Determine whether the types can be hosted in a Context.
            Console.WriteLine("The Contextful property for the
 {0} type is {1}.", GetType(MyTypeDemoClass).Name,
 GetType(MyTypeDemoClass).IsContextful.ToString())
            Console.WriteLine("The Contextful property for the
 {0} type is {1}.", GetType(MyContextBoundClass).Name,
 GetType(MyContextBoundClass).IsContextful.ToString())
            ' Determine whether the types are marshalled by reference.
            Console.WriteLine("The MarshalByRef property of {0}
 is {1}.", GetType(MyTypeDemoClass).Name, GetType(MyTypeDemoClass).IsMarshalByRef.ToString())
            Console.WriteLine("The MarshalByRef property of {0}
 is {1}.", GetType(MyContextBoundClass).Name, GetType(MyContextBoundClass).IsMarshalByRef.ToString())
            ' Determine whether the types are primitive datatypes.
            Console.WriteLine("Is {0} a primitive data type? {1}.",
 GetType(Integer).Name, GetType(Integer).IsPrimitive.ToString())
            Console.WriteLine("Is {0} a primitive data type? {1}.",
 GetType(String).Name, GetType(String).IsPrimitive.ToString())
        Catch e As Exception
            Console.WriteLine("An exception occurred: "
 + e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'MyTypeDemoClass
using System;
using System.Runtime.Remoting.Contexts;
public class MyContextBoundClass: ContextBoundObject
{
    public string myString = "This class
 demonstrates the IsContextful, IsMarshalByRef, and IsPrimitive properties.";
}
public class MyTypeDemoClass
{
    public static void Main()
    {
        try
        {
            // Determine whether the types can be hosted in a Context.
            Console.WriteLine ("The IsContextful property for
 the {0} type is {1}.", typeof(MyTypeDemoClass).Name, typeof(MyTypeDemoClass).IsContextful);
            Console.WriteLine ("The IsContextful property for
 the {0} type is {1}.", typeof(MyContextBoundClass).Name, typeof(MyContextBoundClass).IsContextful);

            // Determine whether the types are marshalled by reference.
            Console.WriteLine ("The MarshalByRef property of {0} is {1}.",
 typeof(MyTypeDemoClass).Name, typeof(MyTypeDemoClass).IsMarshalByRef);
            Console.WriteLine ("The MarshalByRef property of {0} is {1}.",
 typeof(MyContextBoundClass).Name, typeof(MyContextBoundClass).IsMarshalByRef);
            
            // Determine whether the types are primitive datatypes.
            Console.WriteLine ("Is {0} is a primitive data type? {1}.",
 typeof(int).Name, typeof(int).IsPrimitive);
            Console.WriteLine ("Is {0} a primitive data type? {1}.", typeof(string).Name,
 typeof(string).IsPrimitive);
        } 
        catch (Exception e)
        {
            Console.WriteLine("An exception occurred: " + e.Message);
        }
    }
}
using namespace System;
using namespace System::Runtime::Remoting::Contexts;
public ref class MyContextBoundClass: public
 ContextBoundObject
{
public:
   String^ myString;
};

public ref class MyTypeDemoClass
{
public:
   void Demo()
   {
      try
      {
         // Determine whether the types can be hosted in a Context.
         Console::WriteLine( "The IsContextful property for
 the {0} type is {1}.", MyTypeDemoClass::typeid->Name, MyTypeDemoClass::typeid->IsContextful
 );
         Console::WriteLine( "The IsContextful property for
 the {0} type is {1}.", MyContextBoundClass::typeid->Name, MyContextBoundClass::typeid->IsContextful
 );
         
         // Determine whether the types are marshalled by reference.
         Console::WriteLine( "The MarshalByRef property of {0} is {1}.",
 MyTypeDemoClass::typeid->Name, MyTypeDemoClass::typeid->IsMarshalByRef );
         Console::WriteLine( "The MarshalByRef property of {0} is {1}.",
 MyContextBoundClass::typeid->Name, MyContextBoundClass::typeid->IsMarshalByRef
 );
         
         // Determine whether the types are primitive datatypes.
         Console::WriteLine( "Is {0} is a primitive data type? {1}.", int::typeid->Name,
 int::typeid->IsPrimitive );
         Console::WriteLine( "Is {0} a primitive data type? {1}.", String::typeid->Name,
 String::typeid->IsPrimitive );
      }
      catch ( Exception^ e ) 
      {
         Console::WriteLine( "An exception occurred: {0}", e->Message
 );
      }
   }
};

int main()
{
   MyTypeDemoClass^ mtdc = gcnew MyTypeDemoClass;
   mtdc->Demo();
}
import System.*;
import System.Runtime.Remoting.Contexts.*;

public class MyContextBoundClass extends ContextBoundObject
{
    public String myString = "This class
 demonstrates the IsContextful, "
        +"IsMarshalByRef, and IsPrimitive properties.";
} //MyContextBoundClass

public class MyTypeDemoClass
{
    public static void main(String[]
 args)
    {
        try {
            // Determine whether the types can be hosted in a Context.
            Console.WriteLine("The IsContextful property for
 the"
                +" {0} type is {1}.", MyTypeDemoClass.class.ToType().get_Name()
,
                System.Convert.ToString(MyTypeDemoClass.class.ToType().
                get_IsContextful()));
            Console.WriteLine("The IsContextful property for
 the"
                +" {0} type is {1}.", MyContextBoundClass.class.ToType().
                get_Name(), System.Convert.ToString(MyContextBoundClass.class.
                ToType().get_IsContextful()));

            // Determine whether the types are marshalled by reference.
            Console.WriteLine("The MarshalByRef property of {0} is {1}."
,
                MyTypeDemoClass.class.ToType().get_Name(),
                System.Convert.ToString(MyTypeDemoClass.class.ToType().
                get_IsMarshalByRef()));
            Console.WriteLine("The MarshalByRef property of {0} is {1}."
,
                MyContextBoundClass.class.ToType().get_Name()
,
                System.Convert.ToString(MyContextBoundClass.class.ToType().
                get_IsMarshalByRef()));

            // Determine whether the types are primitive datatypes.
            Console.WriteLine("Is {0} is a primitive data type? {1}.",
                int.class.ToType().get_Name()
,
                System.Convert.ToString(int.class.ToType().get_IsPrimitive()));
            Console.WriteLine("Is {0} a primitive data type? {1}.",
                String.class.ToType().get_Name(),System.Convert.ToString(
                String.class.ToType().get_IsPrimitive()));
        }
        catch (System.Exception e) {
            Console.WriteLine("An exception occurred: " + e.get_Message());
        }
    } //main
} //MyTypeDemoClass
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」から_Type.IsPrimitive プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書から_Type.IsPrimitive プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書から_Type.IsPrimitive プロパティを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「_Type.IsPrimitive プロパティ」の関連用語

_Type.IsPrimitive プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



_Type.IsPrimitive プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS