本文整理汇总了C#中MessagePackObject.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# MessagePackObject.GetString方法的具体用法?C# MessagePackObject.GetString怎么用?C# MessagePackObject.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessagePackObject
的用法示例。
在下文中一共展示了MessagePackObject.GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RpcException
/// <summary>
/// Initialize new instance with unpacked data.
/// </summary>
/// <param name="rpcError">
/// Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
/// </param>
/// <param name="unpackedException">
/// Exception data from remote MessagePack-RPC server.
/// </param>
/// <exception cref="SerializationException">
/// Cannot deserialize instance from <paramref name="unpackedException"/>.
/// </exception>
protected internal RpcException( RpcError rpcError, MessagePackObject unpackedException )
: this( rpcError, unpackedException.GetString( MessageKeyUtf8 ), unpackedException.GetString( DebugInformationKeyUtf8 ) )
{
if ( unpackedException.IsDictionary )
{
MessagePackObject mayBeArray;
if ( unpackedException.AsDictionary().TryGetValue( _remoteExceptionsUtf8, out mayBeArray ) && mayBeArray.IsArray )
{
var array = mayBeArray.AsList();
this._remoteExceptions = new RemoteExceptionInformation[ array.Count ];
for ( int i = 0; i < this._remoteExceptions.Length; i++ )
{
if ( array[ i ].IsList )
{
this._remoteExceptions[ i ] = new RemoteExceptionInformation( array[ i ].AsList() );
}
else
{
// Unexpected type.
Debug.WriteLine( "Unexepcted ExceptionInformation at {0}, type: {1}, value: \"{2}\".", i, array[ i ].UnderlyingType, array[ i ] );
this._remoteExceptions[ i ] = new RemoteExceptionInformation( new MessagePackObject[] { array[ i ] } );
}
}
}
}
#if !SILVERLIGHT && !MONO
this.RegisterSerializeObjectStateEventHandler();
#endif
}
示例2: RpcMethodInvocationException
/// <summary>
/// Initialize new instance with unpacked data.
/// </summary>
/// <param name="rpcError">
/// Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
/// </param>
/// <param name="unpackedException">
/// Exception data from remote MessagePack-RPC server.
/// </param>
/// <exception cref="SerializationException">
/// Cannot deserialize instance from <paramref name="unpackedException"/>.
/// </exception>
protected internal RpcMethodInvocationException( RpcError rpcError, MessagePackObject unpackedException )
: base( rpcError, unpackedException )
{
this._methodName = unpackedException.GetString( MethodNameKeyUtf8 );
Contract.Assume( this._methodName != null, "Unpacked data does not have MethodName." );
}
示例3: RpcArgumentException
/// <summary>
/// Initializes a new instance with serialized data.
/// </summary>
/// <param name="unpackedException">
/// Exception data from remote MessagePack-RPC server.
/// </param>
/// <exception cref="SerializationException">
/// Cannot deserialize instance from <paramref name="unpackedException"/>.
/// </exception>
internal RpcArgumentException( MessagePackObject unpackedException )
: base( RpcError.ArgumentError, unpackedException )
{
this._parameterName = unpackedException.GetString( ParameterNameKeyUtf8 );
Contract.Assume( this._parameterName != null, "Unpacked data does not have ParameterName." );
}