当前位置: 首页>>代码示例>>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;未经允许,请勿转载。