vb.net - Display list of acceptable values for parameter of a function in code time -
it clear every vb.net developer when try code in vs, intellisense offers values parameters of .net functions; question how define function when coding, helps choose acceptable value parameter of function?
an image maybe help: 
while enums offer behaviour "natively" exists other non-enum type example system.drawing.color or system.drawing.brush when dotted presents similar list of "harcoded values". , behaviour possible on custom types (at least in vb.net ; unless there changes that's not available in c#).
how work ? it's use of undocumented xml documentation tag namely completionlist in reference type, either same (as color) or (as brush references brushes). , inside type all public static/shared fields , properties in completion list (even aren't of referencing type)
so example (really contrived) have :
''' <completionlist cref="famouspeople"/> class people ' ... end class notinheritable class famouspeople public shared readonly sehnsucht new people("sehnsucht") ' why not ? shared readonly property johnskeet new people("john skeet") shared readonly property ericlippert new people("eric lippert") shared readonly property marcgravell new people("marc gravell") end class (i have put them inside people directly if wanted)
and when have supply value of type people intellisense shows "list" defined (whith choice create 1 not listed if wish of course)
Comments
Post a Comment