本文整理汇总了C#中IWriteContext类的典型用法代码示例。如果您正苦于以下问题:C# IWriteContext类的具体用法?C# IWriteContext怎么用?C# IWriteContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWriteContext类属于命名空间,在下文中一共展示了IWriteContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteTypeInfo
public virtual void WriteTypeInfo(IWriteContext context, ArrayInfo info)
{
BitMap4 typeInfoBitmap = new BitMap4(2);
typeInfoBitmap.Set(0, info.Primitive());
typeInfoBitmap.Set(1, info.Nullable());
context.WriteByte(typeInfoBitmap.GetByte(0));
}
示例2: Write
public virtual void Write(IWriteContext context, object obj)
{
_writeCalls++;
FieldsToTypeHandlerMigrationTestCase.Item item = (FieldsToTypeHandlerMigrationTestCase.Item
)obj;
context.WriteInt(item._id + 42);
}
示例3: Write
public void Write(IWriteContext context, object obj)
{
int classId = ClassMetadataIdFor(context, obj);
context.WriteInt(classId);
context.WriteLong(Convert.ToInt64(obj));
}
示例4: Write
public override void Write(IWriteContext context, object obj)
{
DateTime dateTime = (DateTime)obj;
long ticks = dateTime.Ticks;
context.WriteLong(ticks);
WriteKind(context, dateTime);
}
示例5: Write
public virtual void Write(IWriteContext context, object obj)
{
Array collection = (Array) obj;
ClassMetadata elementType = DetectElementTypeHandler(Container(context), collection);
WriteElementTypeId(context, elementType);
new ArrayHandler(elementType.TypeHandler(), false).Write(context, obj);
}
示例6: Write
// #end example
// #example: Write the StringBuilder
public void Write(IWriteContext writeContext, object o)
{
StringBuilder builder = (StringBuilder) o;
string str = builder.ToString();
byte[] bytes = Encoding.UTF8.GetBytes(str);
writeContext.WriteInt(bytes.Length);
writeContext.WriteBytes(bytes);
}
示例7: Write
public virtual void Write(IWriteContext context, object obj)
{
ICollectionInitializer initializer = CollectionInitializer.For(obj);
IEnumerable enumerable = (IEnumerable)obj;
ClassMetadata elementType = DetectElementTypeErasingNullables(Container(context), enumerable);
WriteElementTypeHandlerId(context, elementType);
WriteElementCount(context, initializer);
WriteElements(context, enumerable, elementType.TypeHandler());
}
示例8: Write
public virtual void Write(IWriteContext context, object obj)
{
ICollection collection = (ICollection)obj;
ITypeHandler4 elementHandler = DetectElementTypeHandler(Container(context), collection
);
WriteElementClassMetadataId(context, elementHandler);
WriteElementCount(context, collection);
WriteElements(context, collection, elementHandler);
}
示例9: Write
public virtual void Write(IWriteContext context, object obj)
{
IDictionary map = (IDictionary)obj;
KeyValueHandlerPair handlers = DetectKeyValueTypeHandlers(Container(context), map
);
WriteClassMetadataIds(context, handlers);
WriteElementCount(context, map);
WriteElements(context, map, handlers);
}
示例10: Write
public override void Write(IWriteContext context, object obj)
{
var charValue = ((char) obj);
context.WriteBytes(new[]
{
(byte) (charValue & unchecked(0xff)), (byte
) (charValue >> 8)
});
}
示例11: Write
public override void Write(IWriteContext context, object obj)
{
ushort us = (ushort)obj;
context.WriteBytes(
new byte[] {
(byte)(us>>8),
(byte)us,
});
}
示例12: WriteElements
private void WriteElements(IWriteContext context, ICollection collection, ITypeHandler4
elementHandler)
{
IEnumerator elements = collection.GetEnumerator();
while (elements.MoveNext())
{
context.WriteObject(elementHandler, elements.Current);
}
}
示例13: WriteElements
private void WriteElements(IWriteContext context, IDictionary map, KeyValueHandlerPair
handlers)
{
IEnumerator elements = map.GetEnumerator();
while (elements.MoveNext())
{
DictionaryEntry entry = (DictionaryEntry)elements.Current;
context.WriteObject(handlers._keyHandler, entry.Key);
context.WriteObject(handlers._valueHandler, entry.Value);
}
}
示例14: Write
public override void Write(IWriteContext context, object obj)
{
uint ui = (uint)obj;
context.WriteBytes(
new byte[] {
(byte)(ui>>24),
(byte)(ui>>16),
(byte)(ui>>8),
(byte)ui,
});
}
示例15: WriteElements
private void WriteElements(IWriteContext context, IDictionary map, KeyValueHandlerPair
handlers)
{
IEnumerator elements = map.Keys.GetEnumerator();
while (elements.MoveNext())
{
object key = elements.Current;
context.WriteObject(handlers._keyHandler, key);
context.WriteObject(handlers._valueHandler, map[key]);
}
}