Example #1
0
        public CatalogueElementName(CatalogueName catalogueName, System.Enum element, string name)
        {
            const string method = ".ctor";

            // Check catalogue name.

            if (catalogueName == null)
            {
                throw new NullParameterException(typeof(CatalogueElementName), method, "catalogueName");
            }

            // Check element.

            if (!NameRegex.IsMatch(element.ToString()))
            {
                throw new InvalidParameterFormatException(typeof(CatalogueElementName), method, "element", element.ToString(), Constants.Validation.CompleteNamePattern);
            }

            // Check name.

            if (name == null)
            {
                throw new NullParameterException(typeof(CatalogueElementName), method, "name");
            }
            if (!NameRegex.IsMatch(name))
            {
                throw new InvalidParameterFormatException(typeof(CatalogueElementName), method, "name", name, Constants.Validation.CompleteNamePattern);
            }

            // Assign.

            m_catalogueName = catalogueName.Clone();
            m_element       = element.ToString();
            m_name          = name;
        }
Example #2
0
 /// <summary>
 /// Private constructor for cloning - performs no checks.
 /// </summary>
 private CatalogueElementName(string name, string element, CatalogueName catalogueName)
 {
     m_name          = name;
     m_element       = element;
     m_catalogueName = catalogueName.Clone();
 }