protected void WriteProperty <T>(string category, string page, string property, T value) { try { var prop = AddIn.TextDocument.DTE.get_Properties(category, page); prop.Item(property).Value = value; } catch (Exception ex) { AddIn.Error(String.Format("Failed to WriteProperty('{0}', '{1}', '{2}')", category, page, property), ex); } }
protected T ReadProperty <T>(string category, string page, string property, T defaultValue) { try { var prop = AddIn.TextDocument.DTE.get_Properties(category, page); return(( T )prop.Item(property).Value); } catch (Exception ex) { AddIn.Error(String.Format("Failed to ReadProperty('{0}', '{1}', '{2}')", category, page, property), ex); return(defaultValue); } }