本文整理汇总了C#中JsonReader.ReadAsDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# JsonReader.ReadAsDateTime方法的具体用法?C# JsonReader.ReadAsDateTime怎么用?C# JsonReader.ReadAsDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonReader
的用法示例。
在下文中一共展示了JsonReader.ReadAsDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadForType
private bool ReadForType(JsonReader reader, JsonContract contract, bool hasConverter, bool inArray)
{
// don't read properties with converters as a specific value
// the value might be a string which will then get converted which will error if read as date for example
if (hasConverter)
return reader.Read();
ReadType t = (contract != null) ? contract.InternalReadType : ReadType.Read;
switch (t)
{
case ReadType.Read:
do
{
if (!reader.Read())
return false;
} while (reader.TokenType == JsonToken.Comment);
return true;
case ReadType.ReadAsInt32:
reader.ReadAsInt32();
break;
case ReadType.ReadAsDecimal:
reader.ReadAsDecimal();
break;
case ReadType.ReadAsBytes:
reader.ReadAsBytes();
break;
case ReadType.ReadAsString:
reader.ReadAsString();
break;
case ReadType.ReadAsDateTime:
reader.ReadAsDateTime();
break;
#if !NET20
case ReadType.ReadAsDateTimeOffset:
reader.ReadAsDateTimeOffset();
break;
#endif
default:
throw new ArgumentOutOfRangeException();
}
return (reader.TokenType != JsonToken.None);
}
示例2: ReadForType
// Token: 0x06000BDA RID: 3034
// RVA: 0x00045F6C File Offset: 0x0004416C
private bool ReadForType(JsonReader reader, JsonContract contract, bool hasConverter)
{
if (hasConverter)
{
return reader.Read();
}
switch ((contract != null) ? contract.InternalReadType : ReadType.Read)
{
case ReadType.Read:
while (reader.Read())
{
if (reader.TokenType != JsonToken.Comment)
{
return true;
}
}
return false;
case ReadType.ReadAsInt32:
reader.ReadAsInt32();
break;
case ReadType.ReadAsBytes:
reader.ReadAsBytes();
break;
case ReadType.ReadAsString:
reader.ReadAsString();
break;
case ReadType.ReadAsDecimal:
reader.ReadAsDecimal();
break;
case ReadType.ReadAsDateTime:
reader.ReadAsDateTime();
break;
default:
throw new ArgumentOutOfRangeException();
}
return reader.TokenType != JsonToken.None;
}