Application Settings + DirectoryInfo / FileInfo

I am still new to C # ... I am creating a WPF application and I am trying to apply some custom application settings. It is easy to insert standard application settings (int, double, string, etc.). I even have something like WindowState.

I would like to have a directory and / or FileInfo as safe settings instead of strings.

Selected type: System.IO.File displays the error message "Abstract types are not supported."

This makes sense, because how can you implement an abstract type as a parameter.

Selected type: System.IO.FileInfo gives the error message "Type" System.IO.FileInfo "not defined.".

Is DirectoryInfo / FileInfo unavailable as application settings? Is it possible? Is it worth the time? How can you determine what can be used as a setting and what not?

My experience with user settings is limited, and I'm trying to expand my knowledge, and this puzzled me.

edit: I tried to post some screenshots, but apparently I'm too new. I work inside Visual Studio, application settings.

further notes:

http://msdn.microsoft.com/en-us/library/a65txexh.aspx

Application parameters can be saved as any data type that is serializable XML or has a TypeConverter that implements ToString / FromString. The most common types are String, Integer, and Boolean, but you can also save values ​​as a color, object, or as a connection string.

DirectoryInfo di = new DirectoryInfo(@"C:\");
di.ToString();

- , ToString()...

+3
1

, . XML. , . .

, , . , , FileInfo DirectoryInfo. , . , .

+2

Source: https://habr.com/ru/post/1761804/


All Articles