public void AddPropertyCodenameConstant(ContentElement element) { if (PropertyCodenameConstantIsAlreadyPresent(element)) { throw new InvalidOperationException($"Property with code name '{element.Codename}' is already included. Can't add two members with the same code name."); } PropertyCodenameConstants.Add(element); }
public void AddPropertyCodenameConstant(string codeName) { if (PropertyCodenameConstants.Contains(codeName)) { throw new InvalidOperationException($"Property with code name '{codeName}' is already included. Can't add two members with the same code name."); } PropertyCodenameConstants.Add(codeName); }
private bool PropertyCodenameConstantIsAlreadyPresent(ContentElement element) { return(PropertyCodenameConstants.Exists(e => e.Codename == element.Codename)); }