本文整理匯總了C#中System.Data.DataColumn.CompareValueTo方法的典型用法代碼示例。如果您正苦於以下問題:C# DataColumn.CompareValueTo方法的具體用法?C# DataColumn.CompareValueTo怎麽用?C# DataColumn.CompareValueTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataColumn
的用法示例。
在下文中一共展示了DataColumn.CompareValueTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SilentlySetValue
internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue) {
// get record for version
int record = dr.GetRecordFromVersion(version);
bool equalValues = false;
if (DataStorage.IsTypeCustomType(dc.DataType) && newValue != dc[record]) {
// if UDT storage, need to check if reference changed. See bug 385182
equalValues = false;
}
else {
equalValues = dc.CompareValueTo(record, newValue, true);
}
// if expression has changed
if (!equalValues) {
int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version);// conditional, if it exists it will try to remove with no event fired
dc.SetValue(record, newValue);
int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version);// conditional, it will insert if it qualifies, no event will be fired
if (dr.HasVersion(version)) {
if (version != DataRowVersion.Original) {
dr.Table.RecordChanged(oldIndex, newIndex);
}
if (dc.dependentColumns != null) {
//BugBug - passing in null for cachedRows. This means expression columns as keys does not work when key changes.
dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null);
}
}
}
dr.ResetLastChangedColumn();
}
示例2: SilentlySetValue
internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue)
{
int recordFromVersion = dr.GetRecordFromVersion(version);
bool flag = false;
if (DataStorage.IsTypeCustomType(dc.DataType) && (newValue != dc[recordFromVersion]))
{
flag = false;
}
else
{
flag = dc.CompareValueTo(recordFromVersion, newValue, true);
}
if (!flag)
{
int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version);
dc.SetValue(recordFromVersion, newValue);
int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version);
if (dr.HasVersion(version))
{
if (version != DataRowVersion.Original)
{
dr.Table.RecordChanged(oldIndex, newIndex);
}
if (dc.dependentColumns != null)
{
dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null);
}
}
}
dr.ResetLastChangedColumn();
}