本文整理匯總了C#中BinaryWriter.WriteBoolean方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryWriter.WriteBoolean方法的具體用法?C# BinaryWriter.WriteBoolean怎麽用?C# BinaryWriter.WriteBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteBoolean方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WriteProxyMethod
/// <summary>
/// Writes proxy method invocation data to the specified writer.
/// </summary>
/// <param name="writer">Writer.</param>
/// <param name="method">Method.</param>
/// <param name="arguments">Arguments.</param>
public static void WriteProxyMethod(BinaryWriter writer, MethodBase method, object[] arguments)
{
Debug.Assert(writer != null);
Debug.Assert(method != null);
writer.WriteString(method.Name);
if (arguments != null)
{
writer.WriteBoolean(true);
writer.WriteInt(arguments.Length);
foreach (var arg in arguments)
writer.WriteObject(arg);
}
else
writer.WriteBoolean(false);
}
示例2: Write
/** <inheritDoc /> */
internal override void Write(BinaryWriter writer, bool keepBinary)
{
if (string.IsNullOrEmpty(Text))
throw new ArgumentException("Text cannot be null or empty");
if (string.IsNullOrEmpty(QueryType))
throw new ArgumentException("QueryType cannot be null or empty");
writer.WriteBoolean(Local);
writer.WriteString(Text);
writer.WriteString(QueryType);
writer.WriteInt(PageSize);
}
示例3: WriteProxyMethod
/// <summary>
/// Writes proxy method invocation data to the specified writer.
/// </summary>
/// <param name="writer">Writer.</param>
/// <param name="method">Method.</param>
/// <param name="arguments">Arguments.</param>
/// <param name="platform">The platform.</param>
public static void WriteProxyMethod(BinaryWriter writer, MethodBase method, object[] arguments,
Platform platform)
{
Debug.Assert(writer != null);
Debug.Assert(method != null);
writer.WriteString(method.Name);
if (arguments != null)
{
writer.WriteBoolean(true);
writer.WriteInt(arguments.Length);
if (platform == Platform.DotNet)
{
// Write as is
foreach (var arg in arguments)
writer.WriteObject(arg);
}
else
{
// Other platforms do not support Serializable, need to convert arrays and collections
var methodArgs = method.GetParameters();
Debug.Assert(methodArgs.Length == arguments.Length);
for (int i = 0; i < arguments.Length; i++)
WriteArgForPlatforms(writer, methodArgs[i], arguments[i]);
}
}
else
writer.WriteBoolean(false);
}
示例4: Write
/** <inheritDoc /> */
internal override void Write(BinaryWriter writer, bool keepBinary)
{
if (string.IsNullOrEmpty(Sql))
throw new ArgumentException("Sql cannot be null or empty");
if (string.IsNullOrEmpty(QueryType))
throw new ArgumentException("QueryType cannot be null or empty");
// 2. Prepare.
writer.WriteBoolean(Local);
writer.WriteString(Sql);
writer.WriteString(QueryType);
writer.WriteInt(PageSize);
WriteQueryArgs(writer, Arguments);
}