I searched the web and found how to add specific custom data type in settings. I'm inserting data by my self, not by code while program running. My problem was how to add custom data type to combobox in designer. Now I figured it out and need advice, how to add data type array of this type. I'll show on simple example.
I have this class
[Serializable()]
public class Product
{
public string Name { get; set; }
public int Price { get; set; }
}
in settings.setting i have setting ProductSettings, type MyApp.Data.Product, scope Application and default value contains following
<xml definition>
<Product xlmns:xsi=.....>
<Name>Banana</Name>
<Price>1</Price>
</Product>
By this way it works just fine. But now, I need get a collection of Products from settings file, so I tryed to specify type as MyApp.Data.Product[] but it can't be. Designer pop-up window and says "MyApp.Data.Product[] is not defined.". How can I figure it out?
Thanks
PF: this project is just class library used from WPF application - if matters
Use System.Collections.Generic.List<MyApp.Data.Product>. Or you can create a class that inherites from List<MyApp.Data.Product>
Then in the value, you will have this format:
<ArrayOfProduct xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=
"http://www.w3.org/2001/XMLSchema">
<Product>
<Name>Banana</Name>
<Price>1</Price>
</Product>
</ArrayOfProduct>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With