コード例 #1
0
        public override async Task <string?> OnSetPropertyValueAsync(
            string unevaluatedPropertyValue,
            IProjectProperties defaultProperties,
            IReadOnlyDictionary <string, string>?dimensionalConditions = null)
        {
            // Don't set the new value if both of the following is true:
            //  1. There is no existing property entry AND
            //  2. The new value is identical to the default value.

            IEnumerable <string> propertyNames = await defaultProperties.GetPropertyNamesAsync();

            if (!propertyNames.Contains(PropertyName))
            {
                if (Version.TryParse(unevaluatedPropertyValue, out Version version))
                {
                    Version defaultVersion = await GetDefaultVersionAsync(defaultProperties);

                    if (version.Equals(defaultVersion))
                    {
                        return(null);
                    }
                }
            }

            return(await base.OnSetPropertyValueAsync(unevaluatedPropertyValue, defaultProperties, dimensionalConditions));
        }
 public virtual Task <IEnumerable <string> > GetPropertyNamesAsync()
 => DelegatedProperties.GetPropertyNamesAsync();