当前位置: 首页>>代码示例>>C#>>正文


C# BuildPropertyGroup.MustBeVirtual方法代码示例

本文整理汇总了C#中Microsoft.Build.BuildEngine.BuildPropertyGroup.MustBeVirtual方法的典型用法代码示例。如果您正苦于以下问题:C# BuildPropertyGroup.MustBeVirtual方法的具体用法?C# BuildPropertyGroup.MustBeVirtual怎么用?C# BuildPropertyGroup.MustBeVirtual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.BuildEngine.BuildPropertyGroup的用法示例。


在下文中一共展示了BuildPropertyGroup.MustBeVirtual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: foreach

        /// <summary>
        /// This method does a comparison of the actual contents of two property bags
        /// and returns True if they are equal, else False.  Equality means that 
        /// the two collections contain the same set of property names (case insensitive)
        /// with the same values (case sensitive).
        /// Requires property group to be virtual.
        /// </summary>
        /// <param name="compareToPropertyGroup"></param>
        /// <owner>RGoel</owner>
        /// <returns>true if the two property bags are equivalent, and false otherwise.</returns>
        internal bool IsEquivalent
        (
            BuildPropertyGroup compareToPropertyGroup
        )
        {
            ErrorUtilities.VerifyThrow(compareToPropertyGroup != null, "Received a null propertyBag!");

            // IsEquivalent is only supported for virtual PropertyGroups.
            this.MustBeVirtual("NeedVirtualPropertyGroup");
            compareToPropertyGroup.MustBeVirtual("NeedVirtualPropertyGroup");

            // Reference equality is easy
            if (this == compareToPropertyGroup)
            {
                return true;
            }

            // First check if the sizes of the two bags match.  If they don't,
            // we don't need to do anything further.
            bool isEqual = true;
            if (this.Count == compareToPropertyGroup.Count)
            {
                // If both bags do have the same number of elements, it should
                // be sufficient to check if one bag contains all of the 
                // elements in the other.
                foreach (DictionaryEntry entry in this.propertyTableByName)
                {
                    BuildProperty leftProperty = (BuildProperty)entry.Value;

                    ErrorUtilities.VerifyThrow(leftProperty != null, "How can we have a null entry in the hash table?");

                    BuildProperty rightProperty = compareToPropertyGroup[(string)entry.Key];

                    if (!leftProperty.IsEquivalent(rightProperty))
                    {
                        isEqual = false;
                        break;
                    }
                }
            }
            else
            {
                // Sizes are unequal
                isEqual = false;
            }

            return isEqual;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:58,代码来源:BuildPropertyGroup.cs


注:本文中的Microsoft.Build.BuildEngine.BuildPropertyGroup.MustBeVirtual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。