當前位置: 首頁>>代碼示例>>C#>>正文


C# ExpandoObject.IsDeletedMember方法代碼示例

本文整理匯總了C#中System.Dynamic.ExpandoObject.IsDeletedMember方法的典型用法代碼示例。如果您正苦於以下問題:C# ExpandoObject.IsDeletedMember方法的具體用法?C# ExpandoObject.IsDeletedMember怎麽用?C# ExpandoObject.IsDeletedMember使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Dynamic.ExpandoObject的用法示例。


在下文中一共展示了ExpandoObject.IsDeletedMember方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetValueIndexCaseInsensitive

 private int GetValueIndexCaseInsensitive(string name, ExpandoObject obj)
 {
     int num = -1;
     lock (obj.LockObject)
     {
         for (int i = this._keys.Length - 1; i >= 0; i--)
         {
             if (string.Equals(this._keys[i], name, StringComparison.OrdinalIgnoreCase) && !obj.IsDeletedMember(i))
             {
                 if (num != -1)
                 {
                     return -2;
                 }
                 num = i;
             }
         }
     }
     return num;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:19,代碼來源:ExpandoClass.cs

示例2: GetValueIndexCaseInsensitive

 /// <summary>
 /// Gets the index at which the value should be stored for the specified name,
 /// the method is only used in the case-insensitive case.
 /// </summary>
 /// <param name="name">the name of the member</param>
 /// <param name="obj">The ExpandoObject associated with the class
 /// that is used to check if a member has been deleted.</param>
 /// <returns>
 /// the exact match if there is one
 /// if there is exactly one member with case insensitive match, return it
 /// otherwise we throw AmbiguousMatchException.
 /// </returns>
 private int GetValueIndexCaseInsensitive(string name, ExpandoObject obj)
 {
     int caseInsensitiveMatch = ExpandoObject.NoMatch; //the location of the case-insensitive matching member
     lock (obj.LockObject)
     {
         for (int i = _keys.Length - 1; i >= 0; i--)
         {
             if (string.Equals(
                 _keys[i],
                 name,
                 StringComparison.OrdinalIgnoreCase))
             {
                 //if the matching member is deleted, continue searching
                 if (!obj.IsDeletedMember(i))
                 {
                     if (caseInsensitiveMatch == ExpandoObject.NoMatch)
                     {
                         caseInsensitiveMatch = i;
                     }
                     else
                     {
                         //Ambiguous match, stop searching
                         return ExpandoObject.AmbiguousMatchFound;
                     }
                 }
             }
         }
     }
     //There is exactly one member with case insensitive match.
     return caseInsensitiveMatch;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:43,代碼來源:ExpandoClass.cs

示例3: GetValueIndexCaseInsensitive

 /// <summary>
 /// Gets the index at which the value should be stored for the specified name,
 /// the method is only used in the case-insensitive case.
 /// </summary>
 /// <param name="name">the name of the member</param>
 /// <param name="obj">The ExpandoObject associated with the class
 /// that is used to check if a member has been deleted.</param>
 /// <returns>
 /// the exact match if there is one
 /// if there is exactly one member with case insensitive match, return it
 /// otherwise we throw AmbiguousMatchException.
 /// </returns>
 private int GetValueIndexCaseInsensitive(string name, ExpandoObject obj) {
     int caseInsensitiveMatch = ExpandoObject.NoMatch; //the location of the case-insensitive matching member
     int exactMatch = ExpandoObject.NoMatch;
     bool hasAmbigousMatch = false;
     bool isMatch = false;
     lock (obj.LockObject) {
         for (int i = _keys.Length - 1; i >= 0; i--) {
             if (!hasAmbigousMatch) {
                 //Do case insensitive search if we are not sure if there are ambigous matches
                 if (string.Equals(
                     _keys[i],
                     name,
                     StringComparison.OrdinalIgnoreCase)) {
                     //if the matching member is deleted, continue searching
                     if (!obj.IsDeletedMember(i)) {
                         if (caseInsensitiveMatch == ExpandoObject.NoMatch) {
                             caseInsensitiveMatch = i;
                         } else {
                             hasAmbigousMatch = true;
                         }
                     }
                     isMatch = true;
                 } else {
                     isMatch = false;
                 }
             }
             //Try searching for exact match if we got a match already and haven't got an exact match.
             if (isMatch && caseInsensitiveMatch != ExpandoObject.NoMatch && exactMatch == ExpandoObject.NoMatch) {
                 if (string.Equals(
                     _keys[i],
                     name,
                     StringComparison.Ordinal)) {
                     if (obj.IsDeletedMember(i)) {
                         //We know there is an exact match but it is deleted.
                         //No need to look for exact match after this.
                         exactMatch = i;
                     } else {
                         //the exact match has the highest priority
                         return i;
                     }
                 }
             }
         }
     }
     //if there is an available exact match, it should have been returned.
     if (hasAmbigousMatch) {
         return ExpandoObject.AmbiguousMatchFound;
     }
     //There is exactly one member with case insensitive match.
     return caseInsensitiveMatch;
 }
開發者ID:octavioh,項目名稱:ironruby,代碼行數:63,代碼來源:ExpandoClass.cs


注:本文中的System.Dynamic.ExpandoObject.IsDeletedMember方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。