IBinarySerialize.Write メソッド
アセンブリ: System.Data (system.data.dll 内)



BinaryWriter を使用してユーザー定義バイナリ形式の UDT をシリアル化する、Write メソッドの実装の例を次に示します。null 文字を埋め込む目的は、文字列値を double 型の値と分離することにあります。これにより、1 つの UDT と Transact-SQL コード内の別の UDT、文字列のバイトと文字列のバイト、および double 型のバイトと double 型のバイトをそれぞれ比較できます。
' The binary layout is as follows: ' Bytes 0 - 19: string text, padded to the right with null characters ' Bytes 20+: Double value Public Sub Write(ByVal w As System.IO.BinaryWriter) _ Implements Microsoft.SqlServer.Server.IBinarySerialize.Write Dim maxStringSize As Integer = 20 Dim stringValue As String = "The value of PI: " Dim paddedString As String Dim value As Double = 3.14159 ' Pad the string from the right with null characters. paddedString = stringValue.PadRight(maxStringSize, ControlChars.NullChar) ' Write the string value one byte at a time. Dim i As Integer For i = 0 To paddedString.Length - 1 Step 1 w.Write(paddedString(i)) Next ' Write the double value. w.Write(value) End Sub
// The binary layout is as follows: // Bytes 0 - 19: string text, padded to the right with null characters // Bytes 20+: Double value public void Write(System.IO.BinaryWriter w) { int maxStringSize = 20; string stringValue = "The value of PI: "; string paddedString; double value = 3.14159; // Pad the string from the right with null characters. paddedString = stringValue.PadRight(maxStringSize, '\0'); // Write the string value one byte at a time. for (int i = 0; i < paddedString.Length; i++) { w.Write(paddedString[i]); } // Write the double value. w.Write(value); }

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に収録されているすべての辞書からIBinarySerialize.Write メソッドを検索する場合は、下記のリンクをクリックしてください。

- IBinarySerialize.Write メソッドのページへのリンク