本文整理汇总了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;
}