_Type.IsValueTypeとは? わかりやすく解説

Type.IsValueType プロパティ

Type値型かどうかを示す値を取得します

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

Dim instance As Type
Dim value As Boolean

value = instance.IsValueType
public bool IsValueType { get;
 }
/** @property */
public final boolean get_IsValueType ()

プロパティ
Type値型である場合trueそれ以外場合false

解説解説
使用例使用例

MyEnum変数作成しIsValueType プロパティチェックして結果表示する例を次に示します

Imports System
Imports Microsoft.VisualBasic
Namespace SystemType
    Public Class [MyClass]

        ' Declare an enum type.
        Enum MyEnum
            One
            Two
        End Enum 'MyEnum

        Public Overloads Shared
 Sub Main()
            Try
                Dim myBool As Boolean
 = False
                Dim myTestEnum As MyEnum =
 MyEnum.One
                ' Get the type of myTestEnum.
                Dim myType As Type = myTestEnum.GetType()
                ' Get the IsValueType property of the myTestEnum variable.
                myBool = myType.IsValueType
                Console.WriteLine(ControlChars.Cr + "Is {0} a
 value type? {1}.", myType.FullName, myBool.ToString())
            Catch e As Exception
                Console.WriteLine(ControlChars.Cr + "An exception
 occurred: {0}", e.Message.ToString())
            End Try
        End Sub 'Main
    End Class '[MyClass] 
End Namespace 'SystemType
using System;
namespace SystemType
{
    public class MyClass
    {
        // Declare an enum type.
        enum MyEnum
        {
            One,
            Two
        }
        public static void
 Main(string []args)
        {
            try
            {
                bool myBool = false;
                MyEnum myTestEnum = MyEnum.One;
                // Get the type of myTestEnum.
                Type myType = myTestEnum.GetType();
                // Get the IsValueType property of the myTestEnum 
                // variable.
                myBool = myType.IsValueType;
                Console.WriteLine("\nIs {0} a value type? {1}.", myType.FullName,
 myBool.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("\nAn exception occurred: {0}", e.Message);
            }
        }
    }
}
using namespace System;

// Declare an enum type.
enum class MyEnum
{
   One, Two
};

int main()
{
   try
   {
      bool myBool = false;
      MyEnum myTestEnum = MyEnum::One;
      
      // Get the type of myTestEnum.
      Type^ myType = myTestEnum.GetType();
      
      // Get the IsValueType property of the myTestEnum
      // variable.
      myBool = myType->IsValueType;
      Console::WriteLine( "\nIs {0} a value type? {1}.", myType->FullName,
 myBool );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "\nAn exception occurred: {0}", e->Message
 );
   }

}

package SystemType;
   
import System.*;

public class MyClass
{
    // Declare an enum type.
    static class MyEnum
    {
        private int member;

        MyEnum()
        {
            member = 0;
        } //MyEnum

        MyEnum(int n)
        {
            member = n;
        } //MyEnum

        public static final int
 one = 0;
        public static final int
 two = 1;
    } //MyEnum

    public static void main(String[]
 args)
    {
        try {
            boolean myBool = false;
            MyEnum myTestEnum = new MyEnum(MyEnum.one);

            // Get the type of myTestEnum.
            Type myType = myTestEnum.GetType();

            // Get the IsValueType property of the myTestEnum variable.
            myBool = myType.get_IsValueType();
            Console.WriteLine("\nIs {0} a value type? {1}.",
                myType.get_FullName(), ((System.Boolean)myBool).ToString());
        }
        catch (System.Exception e) {
            Console.WriteLine("\nAn exception occurred: {0}", e.get_Message());
        }
    } //main
} //MyClass
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Type クラス
Type メンバ
System 名前空間
TypeAttributes
Type.IsClass プロパティ
Type.IsInterface プロパティ
ValueType
IsValueTypeImpl
TypeAttributes
Type.IsClass プロパティ
Type.IsInterface プロパティ
ValueType
IsValueTypeImpl

_Type.IsValueType プロパティ

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

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

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

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

Dim instance As _Type
Dim value As Boolean

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

プロパティ
Type値型である場合trueそれ以外場合false

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


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

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

辞書ショートカット

すべての辞書の索引

「_Type.IsValueType」の関連用語

_Type.IsValueTypeのお隣キーワード
検索ランキング

   

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



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

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

©2024 GRAS Group, Inc.RSS