本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteArray方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteArray方法的具体用法?C# XmlDictionaryWriter.WriteArray怎么用?C# XmlDictionaryWriter.WriteArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteValue
public void WriteValue(XmlDictionaryWriter writer, object value)
{
if (_isArray)
{
switch (_typeCode)
{
case TypeCode.Byte:
{
byte[] arrayValue = (byte[])value;
writer.WriteBase64(arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Boolean:
{
bool[] arrayValue = (bool[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.DateTime:
{
DateTime[] arrayValue = (DateTime[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Decimal:
{
decimal[] arrayValue = (decimal[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Int32:
{
Int32[] arrayValue = (Int32[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Int64:
{
Int64[] arrayValue = (Int64[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Single:
{
float[] arrayValue = (float[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
case TypeCode.Double:
{
double[] arrayValue = (double[])value;
writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
}
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter));
}
}
else
{
switch (_typeCode)
{
case TypeCode.Boolean:
writer.WriteValue((bool)value);
break;
case TypeCode.DateTime:
writer.WriteValue((DateTime)value);
break;
case TypeCode.Decimal:
writer.WriteValue((Decimal)value);
break;
case TypeCode.Double:
writer.WriteValue((double)value);
break;
case TypeCode.Int32:
writer.WriteValue((int)value);
break;
case TypeCode.Int64:
writer.WriteValue((long)value);
break;
case TypeCode.Single:
writer.WriteValue((float)value);
break;
case TypeCode.String:
writer.WriteString((string)value);
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter));
}
}
}
示例2: WriteValue
public void WriteValue(XmlDictionaryWriter writer, object value)
{
if (!this.isArray)
{
switch (this.typeCode)
{
case TypeCode.Int32:
writer.WriteValue((int) value);
return;
case TypeCode.Int64:
writer.WriteValue((long) value);
return;
case TypeCode.Single:
writer.WriteValue((float) value);
return;
case TypeCode.Double:
writer.WriteValue((double) value);
return;
case TypeCode.Decimal:
writer.WriteValue((decimal) value);
return;
case TypeCode.DateTime:
writer.WriteValue((DateTime) value);
return;
case TypeCode.String:
writer.WriteString((string) value);
return;
case TypeCode.Boolean:
writer.WriteValue((bool) value);
return;
}
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidUseOfPrimitiveOperationFormatter")));
}
switch (this.typeCode)
{
case TypeCode.Boolean:
{
bool[] array = (bool[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, array, 0, array.Length);
return;
}
case TypeCode.Byte:
{
byte[] buffer = (byte[]) value;
writer.WriteBase64(buffer, 0, buffer.Length);
return;
}
case TypeCode.Int32:
{
int[] numArray2 = (int[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, numArray2, 0, numArray2.Length);
return;
}
case TypeCode.Int64:
{
long[] numArray3 = (long[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, numArray3, 0, numArray3.Length);
return;
}
case TypeCode.Single:
{
float[] numArray4 = (float[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, numArray4, 0, numArray4.Length);
return;
}
case TypeCode.Double:
{
double[] numArray5 = (double[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, numArray5, 0, numArray5.Length);
return;
}
case TypeCode.Decimal:
{
decimal[] numArray = (decimal[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, numArray, 0, numArray.Length);
return;
}
case TypeCode.DateTime:
{
DateTime[] timeArray = (DateTime[]) value;
writer.WriteArray(null, this.itemName, this.itemNamespace, timeArray, 0, timeArray.Length);
return;
}
}
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidUseOfPrimitiveOperationFormatter")));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:93,代码来源:PrimitiveOperationFormatter.cs