Type.IsValueType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


値型とは、ビットの連続で表される型であり、クラスやインターフェイスではありません。この値型は、一部のプログラミング言語では "構造体" と呼ばれます。列挙型 (Enum) は、値型の特殊な例です。
このプロパティは、ValueType クラスに対して false を返します。
このプロパティは列挙体に対して true を返しますが、Enum 型そのものに対しては返しません。この動作を示す例については、IsEnum のトピックを参照してください。

型 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

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


_Type.IsValueType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)



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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

- Type.IsValueTypeのページへのリンク