开发者

visual studio app settings USAGE

I am not sure how to use Application Setting with custom user types.

For example, in a time tracking system, I would like to have an application setting (with application scope) that says how many hours a day an employee must account for. There is a custom user type, TimeQuantity, with some factory methods and a constructor with a signature of TimeQuantity(double, TimeSliceUnit), where the unit is just an enum.

I can get the settings designer to recognize the TimeQuantity type, but am at a loss开发者_StackOverflow社区 as how to provide the setting value (8d hours, here).

Must I create some sort of settings provider? Build the object outside of the designer? Roll my own settings infrastructure?

Cheers,

Berryl


I was just battling the same issue. As far as I can tell, visual studio doesn't allow you to browse to a type in your current project; you can only browse to types in a referenced assembly. However, you can type the fully qualified name of the type you want to use in the settings 'Select a Type' dialog box like shown below. Note that this won't work until your project has been built with the type you want to reference already included. (Same is true with referenced assemblies.) Hope that helps!

visual studio app settings USAGE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜