BookManagement.Models.CustomProperties.WriteProperty C# (CSharp) Метод

WriteProperty() публичный статический Метод

public static WriteProperty ( string name, string value ) : bool
name string
value string
Результат bool
        public static bool WriteProperty(string name,string value)
        {
            if (value==null) return false;
             XmlDocument doc = new XmlDocument();
            string path ="";
            try
            {
                path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Photos\\properties.xml");
            }
            catch (System.Exception ex)
            {
                return false;
            }

            doc.Load(path);
            IEnumerator ie = doc.SelectNodes("prop").GetEnumerator();

            while (ie.MoveNext())
            {
               (ie.Current as XmlNode)[name].InnerText=value;
            }

            doc.Save(path);
            return true;
        }