本文整理汇总了C#中ReaderContext类的典型用法代码示例。如果您正苦于以下问题:C# ReaderContext类的具体用法?C# ReaderContext怎么用?C# ReaderContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReaderContext类属于命名空间,在下文中一共展示了ReaderContext类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFrom
public object ReadFrom(ReaderContext context)
{
using (MemoryStream input = new MemoryStream())
{
context.HttpStream.CopyTo(input);
return input.ToArray();
}
}
示例2: ReadFrom
public object ReadFrom(ReaderContext context)
{
string text = null;
using (StreamReader r = new StreamReader(context.HttpStream, Encoding.UTF8))
{
text = r.ReadToEnd();
}
return new Cat { Name = text };
}
示例3: ReadFrom
public object ReadFrom(ReaderContext context)
{
Encoding enc = MediaTypeParser.GetEncodingFromCharset(context.Response.ContentType, context.Session.DefaultEncoding);
using (var textReader = new StreamReader(context.HttpStream, enc))
using (var reader = XmlReader.Create(textReader))
{
return ReadFrom(reader, context);
}
}
示例4: Read
protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
{
if (token == SecondaryId)
return _binaryFormatter.Deserialize (r.BaseStream);
Type t = (Type) ReadObject (r, ctx);
int len = Read7BitEncodedInt (r);
Array val = Array.CreateInstance (t, len);
for (int i = 0; i < len; i++)
val.SetValue (ReadObject (r, ctx), i);
return val;
}
示例5: ReaderContext
public ReaderContext(ReaderContext previous)
{
this.Previous = previous;
}
示例6: ReadFrom
protected override object ReadFrom(XmlReader reader, ReaderContext context)
{
return SyndicationItem.Load(reader);
}
示例7: Read
protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
{
Type t = (Type) ReadObject (r, ctx);
int len = Read7BitEncodedInt (r);
Array val = Array.CreateInstance (t, len);
for (int i = 0; i < len; i++)
val.SetValue (ReadObject (r, ctx), i);
return val;
}
示例8: ReadObject
public static object ReadObject (BinaryReader r, ReaderContext ctx)
{
byte sig = r.ReadByte ();
if (sig == 0)
return null;
return readMap [sig].Read (sig, r, ctx);
}
示例9: ReadFrom
public object ReadFrom(ReaderContext context)
{
return context.HttpStream;
}