Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Find() [3/3]

int IBindingList. System.Data.DataView.Find ( PropertyDescriptor property,
object key )
inlineprivateinherited

Implements System.ComponentModel.IBindingList.

Definition at line 927 of file DataView.cs.

928 {
929 if (property != null)
930 {
931 bool flag = false;
932 Index value = null;
933 try
934 {
935 if (_findIndexes == null || !_findIndexes.TryGetValue(property.Name, out value))
936 {
937 flag = true;
939 value.AddRef();
940 }
941 Range range = value.FindRecords(key);
942 if (!range.IsNull)
943 {
944 return _index.GetIndex(value.GetRecord(range.Min));
945 }
946 }
947 finally
948 {
949 if (flag && value != null)
950 {
951 value.RemoveRef();
952 if (value.RefCount == 1)
953 {
954 value.RemoveRef();
955 }
956 }
957 }
958 }
959 return -1;
960 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
Index GetIndex(IndexField[] indexDesc)
DataViewRowState _recordStates
Definition DataView.cs:68
Dictionary< string, Index > _findIndexes
Definition DataView.cs:60
virtual IFilter GetFilter()
Definition DataView.cs:1095
void AddRef()
Definition Index.cs:196
int GetIndex(int record)
Definition Index.cs:371

References System.Data.DataView._findIndexes, System.Data.DataView._index, System.Data.DataView._recordStates, System.Data.DataView._table, System.Data.Index.AddRef(), System.Data.DataView.GetFilter(), System.Data.DataTable.GetIndex(), System.Data.Index.GetIndex(), System.key, System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.