// <copyright file="ConstraintStruct.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
-// <owner current="true" primary="true">Microsoft</owner>
+// <owner current="true" primary="true">[....]</owner>
//------------------------------------------------------------------------------
namespace System.Xml.Schema {
}
hashcode = 0; // indicate it's changed. even the calculated hashcode below is 0
for (int i = 0; i < this.ks.Length; i ++) {
- if (this.ks[i] != null) {
- // extract its primitive value to calculate hashcode
- // decimal is handled differently to enable among different CLR types
- this.ks[i].SetDecimal();
+ // extract its primitive value to calculate hashcode
+ // decimal is handled differently to enable among different CLR types
+ this.ks[i].SetDecimal();
if (this.ks[i].IsDecimal) {
for (int j = 0 ; j < this.ks[i].Dim ; j ++) {
hashcode += this.ks[i].Dvalue[j].GetHashCode();
hashcode += this.ks[i].Value.GetHashCode();
}
}
- }
}
return hashcode;
}
// considering about derived type
public override bool Equals(object other) {
- if (LocalAppContextSwitches.IgnoreEmptyKeySequences) {
- // each key sequence member can have different type
- KeySequence keySequence = (KeySequence)other;
- for (int i = 0; i < this.ks.Length; i++) {
- if (!this.ks[i].Equals(keySequence.ks[i])) {
- return false;
- }
- }
- return true;
- }
- else {
- // each key sequence member can have different type
- KeySequence keySequence = (KeySequence)other;
- for (int i = 0; i < this.ks.Length; i++) {
- if (!(this.ks[i] == null && keySequence.ks[i] == null) && (this.ks[i] == null || keySequence.ks[i] == null || !this.ks[i].Equals(keySequence.ks[i]))) {
- return false;
- }
+ // each key sequence member can have different type
+ KeySequence keySequence = (KeySequence)other;
+ for (int i = 0; i < this.ks.Length; i++) {
+ if (!this.ks[i].Equals(keySequence.ks[i])) {
+ return false;
}
- return true;
}
- }
+ return true;
+ }
public override string ToString() {
- if (LocalAppContextSwitches.IgnoreEmptyKeySequences) {
- StringBuilder sb = new StringBuilder();
- sb.Append(this.ks[0].ToString());
- for (int i = 1; i < this.ks.Length; i++) {
- sb.Append(" ");
- sb.Append(this.ks[i].ToString());
- }
- return sb.ToString();
+ StringBuilder sb = new StringBuilder();
+ sb.Append(this.ks[0].ToString());
+ for (int i = 1; i < this.ks.Length; i++) {
+ sb.Append(" ");
+ sb.Append(this.ks[i].ToString());
}
- else {
- StringBuilder sb = new StringBuilder();
- sb.Append(this.ks[0].ToString());
- for (int i = 1; i < this.ks.Length; i++) {
- sb.Append(" ");
- sb.Append(this.ks[i] == null ? "{}" : this.ks[i].ToString());
- }
- return sb.ToString();
- }
- }
+ return sb.ToString();
+ }
}
}