Here's another goodie from the Visual Studio 2008 SDK. In
ProjectNode.CopyPaste.cs in the namespace Microsoft.VisualStudio.Package you'll find the following code snippet:
StringBuilder selectionContent = null;
// If there is a selection package the data
if (selectedNodes.Count > 1)
{
foreach (HierarchyNode node in selectedNodes)
{
selectionContent = node.PrepareSelectedNodesForClipBoard();
if (selectionContent != null)
{
sb.Append(selectionContent);
}
}
}
else if (selectedNodes.Count == 1)
{
HierarchyNode selectedNode = selectedNodes[0];
selectionContent = selectedNode.PrepareSelectedNodesForClipBoard();
if (selectionContent != null)
{
sb.Append(selectionContent);
}
}
Why do we need this if - else if construct? Does the foreach for a list with zero or one element not work?
Showing posts with label MPF. Show all posts
Showing posts with label MPF. Show all posts
Tuesday, March 4, 2008
Visual Studio 2008 SDK Goodies #3
Labels:
extensibility,
MPF,
SDK,
Visual Studio 2008,
VSX
Thursday, January 17, 2008
Visual Studio 2008 SDK Goodies #2
In ProjectOptions.cs in the Managed Package Framework of Visual Studio 2008 SDK you'll find funny field definitions, e.g.:
///must be an int if not null
public object CodePage;
Why don't they just define it as an int and define some value or exception indicating, that CodePage is not set?
///
public object CodePage;
Why don't they just define it as an int and define some value or exception indicating, that CodePage is not set?
Wednesday, January 16, 2008
Visual Studio 2008 SDK Goodies #1
When working with the Visual Studio 2008 SDK I found several remarkable places in the documentation and also in the source code of the MPF (Managed Package Framework). I'll post them in this blog the next days.
Today's Goodie can be found in several differnt Interfaces which have to be implemented for integrating into Visual Studio. You'll find a whole bunch of interfaces with reserved1() to reserved10() and unused1() to unused10() methods.
E.g. in IVsTextLines:
That's really awesome. Don't the guy's in the different teams at Microsoft know each other?
Today's Goodie can be found in several differnt Interfaces which have to be implemented for integrating into Visual Studio. You'll find a whole bunch of interfaces with reserved1() to reserved10() and unused1() to unused10() methods.
E.g. in IVsTextLines:
Reserved1 | Reserved in the Vtable for future use. (Inherited from IVsTextBuffer.) |
Reserved2 | Reserved in the Vtable for future use. (Inherited from IVsTextBuffer.) |
... | ... |
Reserved10 | Reserved in the Vtable for future use. (Inherited from IVsTextBuffer.) |
That's really awesome. Don't the guy's in the different teams at Microsoft know each other?
Subscribe to:
Posts (Atom)