本文整理汇总了C#中BinaryWriter.WriteInt方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteInt方法的具体用法?C# BinaryWriter.WriteInt怎么用?C# BinaryWriter.WriteInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteQueryArgs
/// <summary>
/// Write query arguments.
/// </summary>
/// <param name="writer">Writer.</param>
/// <param name="args">Arguments.</param>
internal static void WriteQueryArgs(BinaryWriter writer, object[] args)
{
if (args == null)
writer.WriteInt(0);
else
{
writer.WriteInt(args.Length);
foreach (var arg in args)
writer.WriteObject(arg);
}
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}