1. Hello, ADO.NET(JScript.NET) World!

    Posted on 9月 6th, 2012 by cx20

    ADO.NET(JScript.NET)

    ADO.NET(ActiveX Data Objects .NET)は、ADO の後継で .NET ベースの DBMS 接続用 API である。
    .NET データプロバイダを介することで様々な DBMS への接続が可能となっている。
    .NET Framework 標準で使用できる .NET データプロバイダとしては、以下のようなプロバイダがある。

    データプロバイダ名 説明
    System.Data.SqlClient Microsoft SQL Server
    System.Data.OleDb OLE DB
    System.Data.Odbc ODBC
    System.Data.OracleClient Oracle

    ソースコード(JScript.NET + ADO.NET + OLE DB + Jet データベース)

    import System;
    import System.Data.OleDb;
     
    main();
     
    function main() {
        var conStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
            + "Data Source=.\hello.mdb;"
        var sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        var con = new OleDbConnection(conStr);
        var cmd = new OleDbCommand(sqlStr, con);
        con.Open();
        var reader = cmd.ExecuteReader();
        while( reader.Read() )
        {
            Console.WriteLine( reader.GetName(0) );
            Console.WriteLine( "---------------------" );
            Console.WriteLine( reader[0] );
        }
        reader.Close();
        con.Close();
    }

    ソースコード(JScript.NET + ADO.NET + OLE DB + ACE データベース)

    import System;
    import System.Data.OleDb;
     
    main();
     
    function main() {
        var conStr = "Provider=Microsoft.ACE.OLEDB.12.0;"
            + "Data Source=.\hello.accdb;"
        var sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        var con = new OleDbConnection(conStr);
        var cmd = new OleDbCommand(sqlStr, con);
        con.Open();
        var reader = cmd.ExecuteReader();
        while( reader.Read() )
        {
            Console.WriteLine( reader.GetName(0) );
            Console.WriteLine( "---------------------" );
            Console.WriteLine( reader[0] );
        }
        reader.Close();
        con.Close();
    }

    ソースコード(JScript.NET + ADO.NET + SQL Server)

    import System;
    import System.Data.SqlClient;
     
    main();
     
    function main() {
        var conStr = "SERVER=(local);"
            + "DATABASE=master;"
            + "UID=sa;"
            + "PWD=P@ssW0rd";
        var sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        var con = new SqlConnection(conStr);
        var cmd = new SqlCommand(sqlStr, con);
        con.Open();
        var reader = cmd.ExecuteReader();
        while( reader.Read() )
        {
            Console.WriteLine( reader.GetName(0) );
            Console.WriteLine( "---------------------" );
            Console.WriteLine( reader[0] );
        }
        reader.Close();
        con.Close();
    }

    ソースコード(JScript.NET + ADO.NET + Oracle)

    import System;
    import System.Data.OracleClient;
     
    main();
     
    function main() {
        var conStr = "Data Source=ORCL;User ID=scott;Password=tiger;";
        var sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message FROM DUAL";
     
        var con = new OracleConnection(conStr);
        var cmd = new OracleCommand(sqlStr, con);
        con.Open();
        var reader = cmd.ExecuteReader();
        while( reader.Read() )
        {
            Console.WriteLine( reader.GetName(0) );
            Console.WriteLine( "---------------------" );
            Console.WriteLine( reader[0] );
        }
        reader.Close();
        con.Close();
    }

    ソースコード(JScript.NET + ADO.NET + ODBC + MySQL)

    import System;
    import System.Data;
    import System.Data.Odbc;
     
    main();
     
    function main() {
        var conStr = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;UID=root;PWD=P@ssW0rd";
        var sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        var con = new OdbcConnection(conStr);
        var cmd = new OdbcCommand(sqlStr, con);
        con.Open();
        var reader = cmd.ExecuteReader();
        while( reader.Read() )
        {
            Console.WriteLine( reader.GetName(0) );
            Console.WriteLine( "---------------------" );
            Console.WriteLine( reader[0] );
        }
        reader.Close();
        con.Close();
    }

    コンパイル方法(32bit OLE DB 使用時)

    C:¥> jsc /platform:x86 Hello.js

    コンパイル方法(上記以外)

    C:¥> jsc Hello.js

    実行結果

    Message
    ---------------------
    Hello, ADO.NET World!
  2. Hello, ODP.NET(C++/CLI) World!

    Posted on 9月 5th, 2012 by cx20

    ODP.NET(C++/CLI)

    ODP.NET(Oracle Data Provider for .NET)は、.NET ベースの Oracle Database 接続用 API である。ODAC(Oracle Data Access Component)と呼ばれるパッケージに含まれる。
    .NET 環境での Oracle Database 用データプロバイダとしては、マイクロソフト社が提供する「Microsoft Oracle Client」とオラクル社が提供する「ODP.NET」があるが、現在、「Microsoft Oracle Client」はマイクロソフト社自身が非推奨としており、今後は ODP.NET の使用が推奨されている。

    データプロバイダ 説明
    System.Data.OracleClient .NET Framework Data Provider for Oracle
    Oracle.DataAccess.Client Oracle Data Provider for .NET

    ソースコード(C++/CLI + ODP.NET + Oracle)

    #using <System.dll>
    #using <System.Data.dll>
    #using <Oracle.DataAccess.dll>
     
    using namespace System;
    using namespace Oracle::DataAccess::Client;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "Data Source=ORCL;User ID=scott;Password=tiger;";
        String^ sqlStr = "SELECT 'Hello, ODP.NET World!' AS Message FROM DUAL";
     
        OracleConnection^ con = gcnew OracleConnection(conStr);
        OracleCommand^ cmd = gcnew OracleCommand(sqlStr, con);
        con->Open();
        OracleDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    コンパイル方法

    C:¥> SET LIBPATH=<ORA_HOME>odp.netbin2.x;%LIBPATH%
    C:¥> cl Hello.cpp /clr

    実行結果

    MESSAGE
    ---------------------
    Hello, ODP.NET World!
  3. Hello, ADO.NET(C++/CLI) World!

    Posted on 9月 5th, 2012 by cx20

    ADO.NET(C++/CLI)

    ADO.NET(ActiveX Data Objects .NET)は、ADO の後継で .NET ベースの DBMS 接続用 API である。
    .NET データプロバイダを介することで様々な DBMS への接続が可能となっている。
    .NET Framework 標準で使用できる .NET データプロバイダとしては、以下のようなプロバイダがある。

    データプロバイダ名 説明
    System.Data.SqlClient Microsoft SQL Server
    System.Data.OleDb OLE DB
    System.Data.Odbc ODBC
    System.Data.OracleClient Oracle

    ソースコード(C++/CLI + ADO.NET + OLE DB + Jet データベース)

    #using <System.dll>
    #using <System.Data.dll>
     
    using namespace System;
    using namespace System::Data::OleDb;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
            + "Data Source=.\hello.mdb;";
        String^ sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        OleDbConnection^ con = gcnew OleDbConnection(conStr);
        OleDbCommand^ cmd = gcnew OleDbCommand(sqlStr, con);
        con->Open();
        OleDbDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    ソースコード(C++/CLI + ADO.NET + OLE DB + ACE データベース)

    #using <System.dll>
    #using <System.Data.dll>
     
    using namespace System;
    using namespace System::Data::OleDb;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "Provider=Microsoft.ACE.OLEDB.12.0;"
            + "Data Source=.\hello.accdb;";
        String^ sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        OleDbConnection^ con = gcnew OleDbConnection(conStr);
        OleDbCommand^ cmd = gcnew OleDbCommand(sqlStr, con);
        con->Open();
        OleDbDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    ソースコード(C++/CLI + ADO.NET + SQL Server)

    #using <System.dll>
    #using <System.Data.dll>
     
    using namespace System;
    using namespace System::Data::SqlClient;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "SERVER=(local);"
            + "DATABASE=master;"
            + "UID=sa;"
            + "PWD=P@ssW0rd";
        String^ sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        SqlConnection^ con = gcnew SqlConnection(conStr);
        SqlCommand^ cmd = gcnew SqlCommand(sqlStr, con);
        con->Open();
        SqlDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    ソースコード(C++/CLI + ADO.NET + Oracle)

    #using <System.dll>
    #using <System.Data.dll>
    #using <System.Data.OracleClient.dll>
     
    using namespace System;
    using namespace System::Data::OracleClient;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "Data Source=ORCL;User ID=scott;Password=tiger;";
        String^ sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message FROM DUAL";
     
        OracleConnection^ con = gcnew OracleConnection(conStr);
        OracleCommand^ cmd = gcnew OracleCommand(sqlStr, con);
        con->Open();
        OracleDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    ソースコード(C++/CLI + ADO.NET + ODBC + MySQL)

    #using <System.dll>
    #using <System.Data.dll>
     
    using namespace System;
    using namespace System::Data::Odbc;
     
    int main( array<System::String^>^ args )
    {
        String^ conStr = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;UID=root;PWD=P@ssW0rd";
        String^ sqlStr = "SELECT 'Hello, ADO.NET World!' AS Message";
     
        OdbcConnection^ con = gcnew OdbcConnection(conStr);
        OdbcCommand^ cmd = gcnew OdbcCommand(sqlStr, con);
        con->Open();
        OdbcDataReader^ reader = cmd->ExecuteReader();
        while( reader->Read() )
        {
            Console::WriteLine( reader->GetName(0) );
            Console::WriteLine( "---------------------" );
            Console::WriteLine( reader[0] );
        }
        reader->Close();
        con->Close();
     
       return 0;
    }

    コンパイル方法

    C:¥> cl Hello.cpp /clr

    実行結果

    Message
    ---------------------
    Hello, ADO.NET World!
  4. Hello, ODP.NET(VB.NET) World!

    Posted on 9月 3rd, 2012 by cx20

    ODP.NET(VB.NET)

    ODP.NET(Oracle Data Provider for .NET)は、.NET ベースの Oracle Database 接続用 API である。ODAC(Oracle Data Access Component)と呼ばれるパッケージに含まれる。
    .NET 環境での Oracle Database 用データプロバイダとしては、マイクロソフト社が提供する「Microsoft Oracle Client」とオラクル社が提供する「ODP.NET」があるが、現在、「Microsoft Oracle Client」はマイクロソフト社自身が非推奨としており、今後は ODP.NET の使用が推奨されている。

    データプロバイダ 説明
    System.Data.OracleClient .NET Framework Data Provider for Oracle
    Oracle.DataAccess.Client Oracle Data Provider for .NET

    ソースコード(VB.NET + ODP.NET + Oracle)

    Imports System
    Imports Oracle.DataAccess.Client
     
    class Hello
        Shared Sub Main()
            Dim conStr As String = "Data Source=ORCL;" _
                & "User Id=scott;" _
                & "Password=tiger"
     
            Dim sqlStr As String = "SELECT 'Hello, ODP.NET World!' AS Message FROM DUAL"
     
            Dim con As OracleConnection = New OracleConnection(conStr)
            Dim cmd As OracleCommand = New OracleCommand(sqlStr, con)
            con.Open()
            Dim reader As OracleDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    コンパイル方法(VB.NET)

    C:¥> vbc /r:Oracle.DataAccess.dll Hello.vb

    実行結果

    MESSAGE
    ---------------------
    Hello, ODP.NET World!
  5. Hello, ADO.NET(VB.NET) World!

    Posted on 9月 2nd, 2012 by cx20

    ADO.NET(VB.NET)

    ADO.NET(ActiveX Data Objects .NET)は、ADO の後継で .NET ベースの DBMS 接続用 API である。
    .NET データプロバイダを介することで様々な DBMS への接続が可能となっている。
    .NET Framework 標準で使用できる .NET データプロバイダとしては、以下のようなプロバイダがある。

    データプロバイダ名 説明
    System.Data.SqlClient Microsoft SQL Server
    System.Data.OleDb OLE DB
    System.Data.Odbc ODBC
    System.Data.OracleClient Oracle

    ソースコード(VB.NET + ADO.NET + OLE DB + Jet データベース)

    Imports System
    Imports System.Data.OleDb
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
                & "Data Source=hello.mdb;"
            Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message"
     
            Dim con As OleDbConnection = New OleDbConnection(conStr)
            Dim cmd As OleDbCommand = New OleDbCommand(sqlStr, con)
            con.Open()
            Dim reader As OleDbDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    ソースコード(VB.NET + ADO.NET + OLE DB + ACE データベース)

    Imports System
    Imports System.Data.OleDb
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;" _
                & "Data Source=hello.accdb;"
            Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message"
     
            Dim con As OleDbConnection = New OleDbConnection(conStr)
            Dim cmd As OleDbCommand = New OleDbCommand(sqlStr, con)
            con.Open()
            Dim reader As OleDbDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    ソースコード(VB.NET + ADO.NET + SQL Server)

    Imports System
    Imports System.Data.SqlClient
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "SERVER=(local);" _
                & "DATABASE=master;" _
                & "UID=sa;" _
                & "PWD=P@ssW0rd"
            Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message"
     
            Dim con As SqlConnection = New SqlConnection(conStr)
            Dim cmd As SqlCommand = New SqlCommand(sqlStr, con)
            con.Open()
            Dim reader As SqlDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    ソースコード(VB.NET + ADO.NET + Oracle)

    Imports System
    Imports System.Data.OracleClient
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "Data Source=ORCL;User ID=scott;Password=tiger"
            Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message FROM DUAL"
     
            Dim con As OracleConnection = New OracleConnection(conStr)
            Dim cmd As OracleCommand = New OracleCommand(sqlStr, con)
            con.Open()
            Dim reader As OracleDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    ソースコード(VB.NET + ADO.NET + ODBC + MySQL)

    Imports System
    Imports System.Data.Odbc
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;UID=root;PWD=P@ssW0rd"
            Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message"
     
            Dim con As OdbcConnection = New OdbcConnection(conStr)
            Dim cmd As OdbcCommand = New OdbcCommand(sqlStr, con)
            con.Open()
            Dim reader As OdbcDataReader = cmd.ExecuteReader()
            While reader.Read()
                Console.WriteLine( reader.GetName(0) )
                Console.WriteLine( "---------------------" )
                Console.WriteLine( reader(0) )
            End While
            reader.Close()
            con.Close()
        End Sub
    End Class

    コンパイル方法(32bit OLE DB 使用時)

    C:¥> vbc Hello.vb /platform:x86

    コンパイル方法(上記以外)

    C:¥> vbc Hello.vb

    実行結果

    Message
    ---------------------
    Hello, ADO.NET World!
  6. Hello, LINQ(VB.NET) World!

    Posted on 9月 1st, 2012 by cx20

    LINQ(VB.NET)

    LINQ(Language Integrated Query : 統合言語クエリ)は、.NET 言語から DBMS や XML にアクセスする為の汎用クエリ機能である。
    LINQ プロバイダとして、以下のようなものがある。

    LINQ プロバイダ 説明
    LINQ to SQL SQL Server
    LINQ to XML XML ドキュメント
    LINQ to Dataset ADO.NET データセット
    LINQ to Objects .NET コレクション、ファイル、文字列など

    ソースコード(VB.NET + LINQ to SQL)

    ''' -- <事前準備>
    ''' -- 1. テーブル作成
    ''' CREATE TABLE HELLO
    ''' (
    '''     ID      INT         NOT NULL,
    '''     MESSAGE VARCHAR(50) NULL,
    '''     PRIMARY KEY (ID)
    ''' );
    ''' -- 2. データ投入
    ''' INSERT HELLO ( ID, MESSAGE ) VALUES ( 1, 'Hello, LINQ World' );
    ''' -- 3. データ表示
    ''' SELECT * FROM HELLO;
    ''' -- ------------------
    ''' ID MESSAGE
    ''' -- ------------------
    '''  1 Hello, LINQ World!
    ''' -- ------------------
     
    Imports System
    Imports System.Linq
    Imports System.Data.Linq
    Imports System.Data.Linq.Mapping
     
    Public Class HelloDataContext 
        Inherits DataContext
        Public Sub New( ByVal connectionString As String )
            MyBase.New(connectionString)
        End Sub
        Public Hello As Table( Of HelloTable )
    End Class
     
    <Table(Name := "Hello")> _
    Public Class HelloTable
        <Column(IsPrimaryKey := True)> _
        Public Id As Integer
        <Column()> _
        Public Message As String
    End Class
     
    Class Hello
        Shared Sub Main()
            Dim conStr As String = "SERVER=(local);" _
                & "DATABASE=Hello;" _
                & "UID=sa;" _
                & "PWD=P@ssW0rd"
            Dim db = New HelloDataContext( conStr )
     
            Dim q = 
                from h In db.Hello
                Select h
     
            For Each h In q
                Console.WriteLine(h.Message)
            Next
        End Sub
    End Class

    コンパイル方法(VB.NET + LINQ to SQL)

    C:¥> vbc Hello.vb

    実行結果

    Hello, LINQ World!
  7. Hello, DirectX(MSIL) World!

    Posted on 7月 31st, 2012 by cx20

    Win32 DirectX(MSIL)

    DirectX はマイクロソフトが Wnidows 用に開発したマルチメディア処理用 API である。
    .NET Framework 用の DirectX ライブラリとしては、DirectX SDK より入手可能な Managed DirectX がある。
    以下は MSIL における Managed DirectX アプリケーション の例となっている。

    ソースコード

     
    //  Microsoft (R) .NET Framework IL Disassembler.  Version 2.0.50727.42
    //  Copyright (c) Microsoft Corporation.  All rights reserved.
     
    // Metadata version: v2.0.50727
    .assembly extern System.Windows.Forms
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .zV.4..
      .ver 2:0:0:0
    }
    .assembly extern Microsoft.DirectX.Direct3D
    {
      .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
      .ver 1:0:2902:0
    }
    .assembly extern Microsoft.DirectX.Direct3DX
    {
      .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
      .ver 1:0:2911:0
    }
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .zV.4..
      .ver 2:0:0:0
    }
    .assembly extern System.Drawing
    {
      .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
      .ver 2:0:0:0
    }
    .assembly extern System.Windows.Forms as System.Windows.Forms_5
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .zV.4..
      .hash = (46 CF F1 2A B1 D2 B5 94 71 B8 95 F2 3D 65 06 C2   // F..*....q...=e..
               33 D3 CF 05 )                                     // 3...
      .ver 1:0:5000:0
    }
    .assembly extern System.Drawing as System.Drawing_6
    {
      .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
      .hash = (01 F2 8E 4D 2E 2C 74 F0 83 0A 38 19 0C D6 04 59   // ...M.,t...8....Y
               7A 24 81 23 )                                     // z$.#
      .ver 1:0:5000:0
    }
    .assembly Hello
    {
      .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
      .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                                 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
      .hash algorithm 0x00008004
      .ver 0:0:0:0
    }
    .module Hello.exe
    // MVID: {5CADCB46-A918-449C-8A1F-169311ED3D80}
    .imagebase 0x00400000
    .file alignment 0x00000200
    .stackreserve 0x00100000
    .subsystem 0x0002       // WINDOWS_GUI
    .corflags 0x00000003    //  ILONLY 32BITREQUIRED
    // Image base: 0x02FA0000
     
     
    // =============== CLASS MEMBERS DECLARATION ===================
     
    .class public auto ansi beforefieldinit HelloForm
           extends [System.Windows.Forms]System.Windows.Forms.Form
    {
      .field private class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device device_
      .field private class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters presentParam_
      .field private class [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Font font_
      .method public hidebysig specialname rtspecialname 
              instance void  .ctor() cil managed
      {
        // コード サイズ       44 (0x2c)
        .maxstack  8
        IL_0000:  ldarg.0
        IL_0001:  call       instance void [System.Windows.Forms]System.Windows.Forms.Form::.ctor()
        IL_0006:  nop
        IL_0007:  nop
        IL_0008:  ldarg.0
        IL_0009:  ldc.i4     0x280
        IL_000e:  ldc.i4     0x1e0
        IL_0013:  newobj     instance void [System.Drawing]System.Drawing.Size::.ctor(int32,
                                                                                      int32)
        IL_0018:  call       instance void [System.Windows.Forms]System.Windows.Forms.Form::set_Size(valuetype [System.Drawing]System.Drawing.Size)
        IL_001d:  nop
        IL_001e:  ldarg.0
        IL_001f:  ldstr      "Hello, World!"
        IL_0024:  callvirt   instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
        IL_0029:  nop
        IL_002a:  nop
        IL_002b:  ret
      } // end of method HelloForm::.ctor
     
      .method public hidebysig instance bool 
              InitD3D() cil managed
      {
        // コード サイズ       84 (0x54)
        .maxstack  8
        .locals init (bool V_0,
                 class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters[] V_1)
        IL_0000:  nop
        IL_0001:  ldarg.0
        IL_0002:  newobj     instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters::.ctor()
        IL_0007:  stfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters HelloForm::presentParam_
        IL_000c:  ldarg.0
        IL_000d:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters HelloForm::presentParam_
        IL_0012:  ldc.i4.1
        IL_0013:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters::set_Windowed(bool)
        IL_0018:  nop
        IL_0019:  ldarg.0
        IL_001a:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters HelloForm::presentParam_
        IL_001f:  ldc.i4.1
        IL_0020:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters::set_SwapEffect(valuetype [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.SwapEffect)
        IL_0025:  nop
        IL_0026:  ldarg.0
        IL_0027:  ldc.i4.0
        IL_0028:  ldc.i4.1
        IL_0029:  ldarg.0
        IL_002a:  ldc.i4.s   64
        IL_002c:  ldc.i4.1
        IL_002d:  newarr     [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters
        IL_0032:  stloc.1
        IL_0033:  ldloc.1
        IL_0034:  ldc.i4.0
        IL_0035:  ldarg.0
        IL_0036:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters HelloForm::presentParam_
        IL_003b:  stelem.ref
        IL_003c:  ldloc.1
        IL_003d:  newobj     instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::.ctor(int32,
                                                                                                                valuetype [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.DeviceType,
                                                                                                                class [System.Windows.Forms_5]System.Windows.Forms.Control,
                                                                                                                valuetype [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.CreateFlags,
                                                                                                                class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.PresentParameters[])
        IL_0042:  stfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_0047:  ldarg.0
        IL_0048:  call       instance void HelloForm::InitFont()
        IL_004d:  nop
        IL_004e:  ldc.i4.1
        IL_004f:  stloc.0
        IL_0050:  br.s       IL_0052
     
        IL_0052:  ldloc.0
        IL_0053:  ret
      } // end of method HelloForm::InitD3D
     
      .method private hidebysig instance void 
              InitFont() cil managed
      {
        // コード サイズ       51 (0x33)
        .maxstack  4
        .locals init (valuetype [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.FontDescription V_0)
        IL_0000:  nop
        IL_0001:  ldloca.s   V_0
        IL_0003:  call       instance void [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.FontDescription::.ctor()
        IL_0008:  nop
        IL_0009:  ldloca.s   V_0
        IL_000b:  ldc.i4.s   16
        IL_000d:  call       instance void [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.FontDescription::set_Height(int32)
        IL_0012:  nop
        IL_0013:  ldloca.s   V_0
        IL_0015:  ldstr      bytearray (2D FF 33 FF 20 00 B4 30 B7 30 C3 30 AF 30 )       // -.3. ..0.0.0.0
        IL_001a:  call       instance void [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.FontDescription::set_FaceName(string)
        IL_001f:  nop
        IL_0020:  ldarg.0
        IL_0021:  ldarg.0
        IL_0022:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_0027:  ldloc.0
        IL_0028:  newobj     instance void [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Font::.ctor(class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device,
                                                                                                               valuetype [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.FontDescription)
        IL_002d:  stfld      class [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Font HelloForm::font_
        IL_0032:  ret
      } // end of method HelloForm::InitFont
     
      .method public hidebysig instance void 
              Render() cil managed
      {
        // コード サイズ       111 (0x6f)
        .maxstack  6
        .locals init (bool V_0)
        IL_0000:  nop
        IL_0001:  ldarg.0
        IL_0002:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_0007:  ldnull
        IL_0008:  call       bool [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::op_Equality(class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device,
                                                                                                             class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device)
        IL_000d:  ldc.i4.0
        IL_000e:  ceq
        IL_0010:  stloc.0
        IL_0011:  ldloc.0
        IL_0012:  brtrue.s   IL_0017
     
        IL_0014:  nop
        IL_0015:  br.s       IL_006e
     
        IL_0017:  ldarg.0
        IL_0018:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_001d:  ldc.i4.1
        IL_001e:  call       valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::get_Blue()
        IL_0023:  ldc.r4     1.
        IL_0028:  ldc.i4.0
        IL_0029:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::Clear(valuetype [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.ClearFlags,
                                                                                                                valuetype [System.Drawing_6]System.Drawing.Color,
                                                                                                                float32,
                                                                                                                int32)
        IL_002e:  nop
        IL_002f:  ldarg.0
        IL_0030:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_0035:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::BeginScene()
        IL_003a:  nop
        IL_003b:  ldarg.0
        IL_003c:  ldfld      class [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Font HelloForm::font_
        IL_0041:  ldnull
        IL_0042:  ldstr      "Hello, DirectX(MSIL) World!"
        IL_0047:  ldc.i4.s   10
        IL_0049:  ldc.i4.s   10
        IL_004b:  call       valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::get_White()
        IL_0050:  callvirt   instance int32 [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Font::DrawText(class [Microsoft.DirectX.Direct3DX]Microsoft.DirectX.Direct3D.Sprite,
                                                                                                                   string,
                                                                                                                   int32,
                                                                                                                   int32,
                                                                                                                   valuetype [System.Drawing_6]System.Drawing.Color)
        IL_0055:  pop
        IL_0056:  ldarg.0
        IL_0057:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_005c:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::EndScene()
        IL_0061:  nop
        IL_0062:  ldarg.0
        IL_0063:  ldfld      class [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device HelloForm::device_
        IL_0068:  callvirt   instance void [Microsoft.DirectX.Direct3D]Microsoft.DirectX.Direct3D.Device::Present()
        IL_006d:  nop
        IL_006e:  ret
      } // end of method HelloForm::Render
     
      .method public hidebysig static void  Main() cil managed
      {
        .entrypoint
        .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) 
        // コード サイズ       70 (0x46)
        .maxstack  2
        .locals init (class HelloForm V_0,
                 bool V_1)
        IL_0000:  nop
        IL_0001:  newobj     instance void HelloForm::.ctor()
        IL_0006:  stloc.0
        .try
        {
          IL_0007:  nop
          IL_0008:  ldloc.0
          IL_0009:  callvirt   instance bool HelloForm::InitD3D()
          IL_000e:  pop
          IL_000f:  ldloc.0
          IL_0010:  callvirt   instance void [System.Windows.Forms]System.Windows.Forms.Control::Show()
          IL_0015:  nop
          IL_0016:  br.s       IL_0027
     
          IL_0018:  nop
          IL_0019:  ldloc.0
          IL_001a:  callvirt   instance void HelloForm::Render()
          IL_001f:  nop
          IL_0020:  call       void [System.Windows.Forms]System.Windows.Forms.Application::DoEvents()
          IL_0025:  nop
          IL_0026:  nop
          IL_0027:  ldloc.0
          IL_0028:  callvirt   instance bool [System.Windows.Forms]System.Windows.Forms.Control::get_Created()
          IL_002d:  stloc.1
          IL_002e:  ldloc.1
          IL_002f:  brtrue.s   IL_0018
     
          IL_0031:  nop
          IL_0032:  leave.s    IL_0044
     
        }  // end .try
        finally
        {
          IL_0034:  ldloc.0
          IL_0035:  ldnull
          IL_0036:  ceq
          IL_0038:  stloc.1
          IL_0039:  ldloc.1
          IL_003a:  brtrue.s   IL_0043
     
          IL_003c:  ldloc.0
          IL_003d:  callvirt   instance void [mscorlib]System.IDisposable::Dispose()
          IL_0042:  nop
          IL_0043:  endfinally
        }  // end handler
        IL_0044:  nop
        IL_0045:  ret
      } // end of method HelloForm::Main
     
    } // end of class HelloForm
     
     
    // =============================================================
     
    // *********** 逆アセンブルが完了しました ***********************
    // 警告: Win32 リソース ファイル Hello.res を作成しました。

    上記コードは、以下の C# の実行ファイルを ildasm.exe で逆アセンブルしたものである。

    ソースコード

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    using Microsoft.DirectX;
    using Microsoft.DirectX.Direct3D;
     
    public class HelloForm : Form
    {
        private Device device_;
        private PresentParameters presentParam_;
        private Microsoft.DirectX.Direct3D.Font font_;
     
        public HelloForm()
        {
            this.Size = new Size(640, 480);
            this.Text = "Hello, World!";
        }
     
        public bool InitD3D()
        {
            presentParam_ = new PresentParameters();
     
            presentParam_.Windowed = true;
            presentParam_.SwapEffect = SwapEffect.Discard;
     
            device_ = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, presentParam_);
     
            InitFont();
     
            return true;
        }
     
        private void InitFont()
        {
            FontDescription fd = new FontDescription();
     
            fd.Height = 16;
            fd.FaceName = "MS ゴシック";
     
            font_ = new Microsoft.DirectX.Direct3D.Font(device_, fd);
        }
     
        public void Render()
        {
            if (device_ == null)
            {
                return;
            }
     
            device_.Clear(ClearFlags.Target, Color.Blue, 1.0f, 0);
            device_.BeginScene();
     
            font_.DrawText(null, "Hello, DirectX(MSIL) World!", 10, 10, Color.White);
     
            device_.EndScene();
            device_.Present();
        }
     
        [STAThread]
        public static void Main()
        {
            using (HelloForm form = new HelloForm())
            {
                form.InitD3D();
                form.Show();
     
                while (form.Created)
                {
                    form.Render();
                    Application.DoEvents();
                }
            }
        }
    }

    コンパイル方法

    C:¥> ilasm Hello.il

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, DirectX(MSIL) World!               |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  8. Hello, DirectX(C++/CLI) World!

    Posted on 7月 30th, 2012 by cx20

    Win32 DirectX(C++/CLI)

    DirectX はマイクロソフトが Wnidows 用に開発したマルチメディア処理用 API である。
    .NET Framework 用の DirectX ライブラリとしては、DirectX SDK より入手可能な Managed DirectX がある。
    以下は C++/CLI における Managed DirectX アプリケーション の例となっている。

    ソースコード

    #using <System.dll>
    #using <System.Drawing.dll>
    #using <System.Windows.Forms.dll>
    #using <Microsoft.DirectX.dll>
    #using <Microsoft.DirectX.Direct3D.dll>
     
     
    using namespace System;
    using namespace System::Drawing;
    using namespace System::Windows::Forms;
    using namespace Microsoft::DirectX;
    using namespace Microsoft::DirectX::Direct3D;
     
    public ref class HelloForm : public Form
    {
    public:
        HelloForm()
        {
            this->Size = System::Drawing::Size( 640, 480 );
            this->Text = "Hello, World!";
        }
        bool InitD3D()
        {
            presentParam_ = gcnew PresentParameters();
            presentParam_->Windowed = true;
            presentParam_->SwapEffect = SwapEffect::Discard;
            device_ = gcnew Device(0, DeviceType::Hardware, this, CreateFlags::HardwareVertexProcessing, presentParam_);
     
            InitFont();
     
            return true;
        }
        void InitFont()
        {
            FontDescription fd;
     
            fd.Height = 16;
            fd.FaceName = "MS ゴシック";
     
            font_ = gcnew Microsoft::DirectX::Direct3D::Font(device_, fd);
        }
        void Render()
        {
            if (device_ == nullptr)
            {
                return;
            }
     
            device_->Clear(ClearFlags::Target, Color::Blue, 1.0f, 0);
            device_->BeginScene();
     
            font_->DrawText(nullptr, "Hello, DirectX(C++/CLI) World!", 10, 10, Color::White);
     
            device_->EndScene();
            device_->Present();
        }
    private:
        Device^ device_;
        PresentParameters^ presentParam_;
        Microsoft::DirectX::Direct3D::Font^ font_;
    };
     
    int main( array<System::String^>^ args )
    {
        HelloForm^ form = gcnew HelloForm();
     
        form->InitD3D();
        form->Show();
     
        while (form->Created)
        {
            form->Render();
            Application::DoEvents();
        }
     
        return 0;
    }

    コンパイル方法

    C:¥> cl Hello.cpp /clr ^
         /AI "C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2911.0" ^
         /AI "C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0" ^
         /FU "Microsoft.DirectX.dll" ^
         /FU "Microsoft.DirectX.Direct3D.dll" ^
         /FU "Microsoft.DirectX.Direct3DX.dll" ^
         /link /SUBSYSTEM:WINDOWS /ENTRY:main

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, DirectX(C++/CLI) World!            |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  9. Hello, DirectX(VB.NET) World!

    Posted on 7月 29th, 2012 by cx20

    Win32 DirectX(VB.NET)

    DirectX はマイクロソフトが Wnidows 用に開発したマルチメディア処理用 API である。
    .NET Framework 用の DirectX ライブラリとしては、DirectX SDK より入手可能な Managed DirectX がある。
    以下は VB.NET における Managed DirectX アプリケーション の例となっている。

    ソースコード

    Imports System
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports Microsoft.DirectX
    Imports Microsoft.DirectX.Direct3D
     
    Public Class HelloForm
        Inherits Form
     
        Private device_ As Device
        Private presentParam_ As PresentParameters
        Private font_ As Microsoft.DirectX.Direct3D.Font
     
        Public Sub New()
            MyBase.Size = New Size(640, 480)
            Me.Text = "Hello, World!"
        End Sub
     
        Public Function InitD3D() As Boolean
            Me.presentParam_ = New PresentParameters()
            Me.presentParam_.Windowed = True
            Me.presentParam_.SwapEffect = SwapEffect.Discard
            Me.device_ = New Device(0, DeviceType.Hardware, Me, CreateFlags.HardwareVertexProcessing, Me.presentParam_)
            Me.InitFont()
            Return True
        End Function
     
        Private Sub InitFont()
            Dim description As FontDescription = New FontDescription()
            description.Height = 16
            description.FaceName = "MS ゴシック"
            Me.font_ = New Microsoft.DirectX.Direct3D.Font(Me.device_, description)
        End Sub
     
        Public Sub Render()
            If Not Me.device_ Is Nothing Then
                Me.device_.Clear(ClearFlags.Target, Color.Blue, 1.0F, 0)
                Me.device_.BeginScene()
     
                Me.font_.DrawText(Nothing, "Hello, DirectX(VB.NET) World!", New Point(10, 10), Color.White)
                Me.device_.EndScene()
                Me.device_.Present()
            End If
        End Sub
     
        Shared Sub Main()
            Using helloForm As New HelloForm()
                helloForm.InitD3D()
                helloForm.Show()
                While helloForm.Created
                    helloForm.Render()
                    Application.DoEvents()
                End While
            End Using
        End Sub
    End Class

    コンパイル方法

    C:¥> vbc ^
        /target:winexe ^
        /platform:x86 ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0Microsoft.DirectX.dll" ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0Microsoft.DirectX.Direct3D.dll" ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2911.0Microsoft.DirectX.Direct3DX.dll" ^
        Hello.vb

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, DirectX(VB.NET) World!             |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  10. Hello, DirectX(C#) World!

    Posted on 7月 28th, 2012 by cx20

    Win32 DirectX(C#)

    DirectX はマイクロソフトが Wnidows 用に開発したマルチメディア処理用 API である。
    .NET Framework 用の DirectX ライブラリとしては、DirectX SDK より入手可能な Managed DirectX がある。
    以下は C# における Managed DirectX アプリケーション の例となっている。

    ソースコード

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    using Microsoft.DirectX;
    using Microsoft.DirectX.Direct3D;
     
    public class HelloForm : Form
    {
        private Device device_;
        private PresentParameters presentParam_;
        private Microsoft.DirectX.Direct3D.Font font_;
     
        public HelloForm()
        {
            this.Size = new Size(640, 480);
            this.Text = "Hello, World!";
        }
     
        public bool InitD3D()
        {
            presentParam_ = new PresentParameters();
     
            presentParam_.Windowed = true;
            presentParam_.SwapEffect = SwapEffect.Discard;
     
            device_ = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, presentParam_);
     
            InitFont();
     
            return true;
        }
     
        private void InitFont()
        {
            FontDescription fd = new FontDescription();
     
            fd.Height = 16;
            fd.FaceName = "MS ゴシック";
     
            font_ = new Microsoft.DirectX.Direct3D.Font(device_, fd);
        }
     
        public void Render()
        {
            if (device_ == null)
            {
                return;
            }
     
            device_.Clear(ClearFlags.Target, Color.Blue, 1.0f, 0);
            device_.BeginScene();
     
            font_.DrawText(null, "Hello, DirectX(C#) World!", 10, 10, Color.White);
     
            device_.EndScene();
            device_.Present();
        }
     
        [STAThread]
        public static void Main()
        {
            using (HelloForm form = new HelloForm())
            {
                form.InitD3D();
                form.Show();
     
                while (form.Created)
                {
                    form.Render();
                    Application.DoEvents();
                }
            }
        }
    }

    コンパイル方法

    C:¥> csc ^
        /target:winexe ^
        /platform:x86 ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0Microsoft.DirectX.dll" ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2902.0Microsoft.DirectX.Direct3D.dll" ^
        /r:"C:WindowsMicrosoft.NETDirectX for Managed Code1.0.2911.0Microsoft.DirectX.Direct3DX.dll" ^
        Hello.cs

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, DirectX(C#) World!                 |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+