/// <summary> /// Check if this instance is equal to another object that /// implements <see cref="IValueMetaData"/>. /// </summary> /// <param name="other"> /// The <see cref="IValueMetaData"/> to check for /// equality /// </param> /// <returns> /// True if the two instances are equal. /// False otherwise /// </returns> public bool Equals(IValueMetaData other) { if (other == null) { return(false); } return(GetProperty().Equals(other.GetProperty()) && Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase)); }
/// <summary> /// Check if this instance is equal to another object that /// implements <see cref="IValueMetaData"/>. /// </summary> /// <param name="other"> /// The <see cref="IValueMetaData"/> to check for /// equality /// </param> /// <returns> /// True if the two instances are equal. /// False otherwise /// </returns> public bool Equals(IValueMetaData other) { if (other == null) { return(false); } using (var property = GetProperty()) { return(property.Equals(other.GetProperty())); } }
/// <summary> /// Compare this instance with another object that implements /// <see cref="IValueMetaData"/> /// </summary> /// <param name="other"> /// The <see cref="IValueMetaData"/> to compare to /// </param> /// <returns> /// >0 if this instance precedes `other` in the sort order. /// 0 if they are equal in the sort order. /// <0 if `other` precedes this instance in the sort order. /// </returns> public int CompareTo(IValueMetaData other) { if (other == null) { return(-1); } var difference = GetProperty().CompareTo(other.GetProperty()); if (difference == 0) { difference = string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase); } return(difference); }
/// <summary> /// Get the meta-data for the specified property and value from /// this profile. /// </summary> /// <param name="propertyName"> /// The name of the property to get the meta-data for. /// </param> /// <param name="valueName"> /// The value to get the meta-data for. /// </param> /// <returns> /// The value meta-data for the specified value if it exists /// on this profile. /// </returns> public IValueMetaData GetValue(string propertyName, string valueName) { IValueMetaData result = null; using (var values = _engine.MetaData.getValuesForProfile(_source)) { using (var key = new ValueMetaDataKeySwig( propertyName, valueName)) { #pragma warning disable CA2000 // Dispose objects before losing scope // The ValueMetaDataSwig instance is used and disposed // by the ValueMetaData object. var value = values.getByKey(key); #pragma warning restore CA2000 // Dispose objects before losing scope if (value != null) { result = new ValueMetaData(_engine, value); } } } return(result); }