本文整理匯總了C#中System.Xml.Schema.XmlSchemaDatatype.Compare方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaDatatype.Compare方法的具體用法?C# XmlSchemaDatatype.Compare怎麽用?C# XmlSchemaDatatype.Compare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Schema.XmlSchemaDatatype
的用法示例。
在下文中一共展示了XmlSchemaDatatype.Compare方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckValueFacets
internal override Exception CheckValueFacets(DateTime value, XmlSchemaDatatype datatype)
{
RestrictionFacets restriction = datatype.Restriction;
RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
if (((flags & RestrictionFlags.MaxInclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MaxInclusive) > 0))
{
return new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MaxExclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MaxExclusive) >= 0))
{
return new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinInclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MinInclusive) < 0))
{
return new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinExclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MinExclusive) <= 0))
{
return new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
{
return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
}
return null;
}
示例2: MatchEnumeration
private bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype)
{
for (int i = 0; i < enumeration.Count; i++)
{
if (datatype.Compare(value, (DateTime) enumeration[i]) == 0)
{
return true;
}
}
return false;
}
示例3: MatchEnumeration
internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
{
for (int i = 0; i < enumeration.Count; i++)
{
if (datatype.Compare(value, enumeration[i]) == 0)
{
return true;
}
}
return false;
}
示例4: MatchEnumeration
internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
for (int i = 0; i < enumeration.Count; ++i) {
if (datatype.Compare(value, enumeration[i]) == 0) { //Compare on Datatype_union will compare two XsdSimpleValue
return true;
}
}
return false;
}
示例5: MatchEnumeration
internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
foreach(object correctValue in enumeration) {
if (datatype.Compare(value, correctValue) == 0) { //Compare on Datatype_union will compare two XsdSimpleValue
return true;
}
}
return false;
}