本文整理汇总了C#中IType.IsPrimaryType方法的典型用法代码示例。如果您正苦于以下问题:C# IType.IsPrimaryType方法的具体用法?C# IType.IsPrimaryType怎么用?C# IType.IsPrimaryType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.IsPrimaryType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsAllowedPrimitiveType
public static bool IsAllowedPrimitiveType(IType type)
{
return !(type is DictionaryType || type is SequenceType || type.IsPrimaryType(KnownPrimaryType.Stream));
}
示例2: NeedsSpecialSerialization
private bool NeedsSpecialSerialization(IType type)
{
var known = type as PrimaryType;
return known != null &&
type.IsPrimaryType(KnownPrimaryType.ByteArray) ||
type is SequenceType;
}
示例3: isSpecial
private bool isSpecial(IType type)
{
if (type.IsPrimaryType(KnownPrimaryType.DateTime) ||
type.IsPrimaryType(KnownPrimaryType.Date) ||
type.IsPrimaryType(KnownPrimaryType.DateTimeRfc1123) ||
type.IsPrimaryType(KnownPrimaryType.ByteArray) ||
type is CompositeType)
{
return true;
}
else if (type is SequenceType)
{
return isSpecial(((SequenceType)type).ElementType);
}
else if (type is DictionaryType)
{
return isSpecial(((DictionaryType)type).ValueType);
}
return false;
}
示例4: GetDeserializationSettingsReference
/// <summary>
/// Returns deserialization settings reference.
/// </summary>
/// <param name="deserializationType"></param>
/// <returns></returns>
public string GetDeserializationSettingsReference(IType deserializationType)
{
SequenceType sequenceType = deserializationType as SequenceType;
DictionaryType dictionaryType = deserializationType as DictionaryType;
if (deserializationType.IsPrimaryType(KnownPrimaryType.Date) ||
(sequenceType != null && sequenceType.ElementType is PrimaryType
&& ((PrimaryType)sequenceType.ElementType).Type == KnownPrimaryType.Date) ||
(dictionaryType != null && dictionaryType.ValueType is PrimaryType
&& ((PrimaryType)dictionaryType.ValueType).Type == KnownPrimaryType.Date))
{
return "new DateJsonConverter()";
}
if (deserializationType.IsPrimaryType(KnownPrimaryType.Base64Url) ||
(sequenceType != null && sequenceType.ElementType is PrimaryType
&& ((PrimaryType)sequenceType.ElementType).Type == KnownPrimaryType.Base64Url) ||
(dictionaryType != null && dictionaryType.ValueType is PrimaryType
&& ((PrimaryType)dictionaryType.ValueType).Type == KnownPrimaryType.Base64Url))
{
return "new Base64UrlJsonConverter()";
}
return ClientReference + ".DeserializationSettings";
}