IStateFormatter.Serialize メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As IStateFormatter Dim state As Object Dim returnValue As String returnValue = instance.Serialize(state)
戻り値
Web サーバー コントロールのビューステートを表す文字列。


Serialize メソッドでビューステート情報をファイルに保持する方法を次のコード例に示します。StreamPageStatePersister クラスの Save メソッドでは、PageStatePersister クラスから継承した IStateFormatter インターフェイスを使用して、ビューステートをシリアル化します。このコード例は IStateFormatter インターフェイスのトピックで取り上げているコード例の一部分です。
' ' Persist any ViewState and ControlState. ' Public Overrides Sub Save() If Not (ViewState Is Nothing) OrElse Not (ControlState Is Nothing) Then If Not (Page.Session Is Nothing) Then Dim stateStream As Stream stateStream = GetSecureStream() ' Write a state string, using the StateFormatter. Dim writer As New StreamWriter(stateStream) Dim formatter As IStateFormatter formatter = Me.StateFormatter Dim statePair As New Pair(ViewState, ControlState) Dim serializedState As String serializedState = formatter.Serialize(statePair) writer.Write(serializedState) writer.Close() stateStream.Close() Else Throw New InvalidOperationException("Session needed for StreamPageStatePersister.") End If End If End Sub 'Save
// // Persist any ViewState and ControlState. // public override void Save() { if (ViewState != null || ControlState != null) { if (Page.Session != null) { Stream stateStream = GetSecureStream(); StreamWriter writer = new StreamWriter(stateStream); IStateFormatter formatter = this.StateFormatter; Pair statePair = new Pair(ViewState, ControlState); // Serialize the statePair object to a string. string serializedState = formatter.Serialize(statePair); writer.Write(serializedState); writer.Close(); stateStream.Close(); } else throw new InvalidOperationException("Session needed for StreamPageStatePersister."); } }

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


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

- IStateFormatter.Serialize メソッドのページへのリンク