Skip to content

Commit e8bf55b

Browse files
authored
Code formatting and syntax highlighting
1 parent 96ad70f commit e8bf55b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

docs/extensibility/internals/command-implementation.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,25 @@ The following sections explain how to register and implement commands.
2525
## Register commands with Visual Studio
2626
If your command is to appear on a menu, you must add the <xref:Microsoft.VisualStudio.Shell.ProvideMenuResourceAttribute> to your VSPackage, and use as a value either the name of the menu or its resource ID.
2727

28-
```
28+
```c#
2929
[ProvideMenuResource("Menus.ctmenu", 1)]
30-
...
31-
public sealed class MyPackage : Package
32-
{.. ..}
33-
30+
public sealed class MyPackage : Package
31+
{
32+
// ...
33+
}
3434
```
3535

3636
In addition, you must register the command with the <xref:Microsoft.VisualStudio.Shell.OleMenuCommandService>. You can get this service by using the <xref:Microsoft.VisualStudio.Shell.Package.GetService%2A> method if your VSPackage is derived from <xref:Microsoft.VisualStudio.Shell.Package>.
3737

38-
```
38+
```c#
3939
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
40-
if ( null != mcs )
40+
if (mcs is not null)
4141
{
4242
// Create the command for the menu item.
4343
CommandID menuCommandID = new CommandID(guidCommandGroup, myCommandID);
44-
MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
45-
mcs.AddCommand( menuItem );
44+
MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID);
45+
mcs.AddCommand(menuItem);
4646
}
47-
4847
```
4948

5049
## Implement commands

0 commit comments

Comments
 (0)