WPF: Add custom type object to Settings

Just add such code to existing Settings.cs file (Settings.settings -> View code):

		public List< (DateTime, decimal profitLoss)> ProfitLosses
			get => (List< (DateTime, decimal profitLoss)>)(this["ProfitLosses"]);
			set => this["ProfitLosses"] = value;

Here line


allows to initialize object with default value (with empty List in this case) instead of set it null

Leave a Reply