IBinarySerialize.Read メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IBinarySerialize.Read メソッドの意味・解説 

IBinarySerialize.Read メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

ユーザー定義型 (UDT) またはユーザー定義集計をバイナリ形式から生成します

名前空間: Microsoft.SqlServer.Server
アセンブリ: System.Data (system.data.dll 内)
構文構文

Sub Read ( _
    r As BinaryReader _
)
Dim instance As IBinarySerialize
Dim r As BinaryReader

instance.Read(r)
void Read (
    BinaryReader r
)
void Read (
    BinaryReader^ r
)
void Read (
    BinaryReader r
)
function Read (
    r : BinaryReader
)

パラメータ

r

オブジェクトの逆シリアル化元である BinaryReader ストリーム

解説解説
使用例使用例

以前永続化した UDT を、BinaryReader使用してシリアル化する Read メソッド実装の例次に示します。この例は、UDT2 つデータ プロパティ StringValueDoubleValue持っている仮定してます。

' The binary layout is as follows:
'    Bytes 0 - 19: string text, padded to the right with null
'    characters
'    Bytes 20+: double value
Public Sub Read(ByVal r
 As System.IO.BinaryReader) _
  Implements Microsoft.SqlServer.Server.IBinarySerialize.Read
    
    Dim maxStringSize As Integer
 = 20
    Dim chars As Char()
    Dim stringEnd As Integer
    Dim stringValue As String
    Dim value As double

    ' Read the characters from the binary stream.
    chars = r.ReadChars(maxStringSize)
    
    ' Find the start of the null character padding.
    stringEnd = Array.IndexOf(chars, ControlChars.NullChar)

    If StringEnd = 0 Then
       stringValue = Nothing
       Exit Sub
    End If

    ' Build the string from the array of characters.
    stringValue = new String(chars, 0, stringEnd)

    ' Read the double value from the binary stream.
    value = r.ReadDouble()

    ' Set the object's properties equal to the values.
    Me.StringValue = stringValue
    Me.DoubleValue = 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 Read(System.IO.BinaryReader r)
{

    int maxStringSize = 20;
    char[] chars;
    int stringEnd;
    string stringValue;
    double doubleValue;

    // Read the characters from the binary stream.
    chars = r.ReadChars(maxStringSize);

    // Find the start of the null character padding.
    stringEnd = Array.IndexOf(chars, '\0');

    if (stringEnd == 0)
    {
        stringValue = null;
        return;
    }

    // Build the string from the array of characters.
    stringValue = new String(chars, 0, stringEnd);

    // Read the double value from the binary stream.
    doubleValue = r.ReadDouble();

    // Set the object's properties equal to the values.
    this.StringValue = stringValue;
    this.DoubleValue = doubleValue;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IBinarySerialize インターフェイス
IBinarySerialize メンバ
Microsoft.SqlServer.Server 名前空間



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

辞書ショートカット

すべての辞書の索引

「IBinarySerialize.Read メソッド」の関連用語

IBinarySerialize.Read メソッドのお隣キーワード
検索ランキング

   

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



IBinarySerialize.Read メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS