This topic contains 5 replies, has 4 voices, and was last updated by
June 30, 2019 at 5:58 pm #163347
I have written a PowerShell Class with static methods. It works quite swiftly and efficiently.
I would like the ability to add comments to the Class and the Methods which will appear in an IDE (e.g. VScode) while writing Advanced Functions that use the Class. In Python one can surround the comments with three single quotes ("'comment"') as shown below. Those comments appear in VScode when writing against the class/function.
Is there a Methodology (wink) for this in PowerShell? If so, what is it? I've tried /// and # and "' to no avail.
"'My Comments Here"'
"'More comments here"'
# Comments here that are used by Intellisense?
static [hashtable] myMethod ([string] $myVar)
# Comments here that are used by Intellisense
June 30, 2019 at 6:28 pm #163356ParticipantTopics: 0Replies: 44Points: 235Rank: Participant
June 30, 2019 at 8:06 pm #163368
The link does not mention classes, methods, or how to make comments for them that appear in intellisense. So no, not at all helpful. Thanks tho.
June 30, 2019 at 8:42 pm #163371ParticipantTopics: 2Replies: 999Points: 1,946Rank: Community Hero
Why not just look at the PowerShell classes MS provides that are already on your system as the examples to follow for your use case, or jump out to the PowerShell Core OSS repo and look at the source code for all the cmdlet for examples?
This ' /// ' of course is not how you do comments in PowerShell proper. There is on '#' or '< ##>' , though the .Net stuff (C#, etc.) does use that, thus, well, you know.
Comment-based Help for classes
How To Document Your PowerShell Library
July 1, 2019 at 4:37 pm #163545ParticipantTopics: 2Replies: 54Points: 278Rank: Contributor
July 2, 2019 at 4:19 am #163659
You must be logged in to reply to this topic.