MSDN code examples could be incorrect as well
It was really odd for me to find an error in MSDN code example which took almost a couple of hours to figure out what is wrong. I am working in VSTO (Visual Studio Tool for Office). I am developing a plugin which is suppose to override some of the specific Office 2007 functionalities and implement some custom actions. My quest for knowledge took me here. I found this page very interesting and I found the explanation for exactly what was required. I took the C# code example as it is and tried to play around in my own sample. Sadly, the example which is given on the page in C# has a flaw.
public void mySave(IRibbonControl control, bool cancelDefault) { If (repurposing) { MessageBox.Show("The Save button has been temporarily repurposed."); cancelDefault = False; } else { cancelDefault = False; } }
In this code example, the second parameter should be a reference type. Visual basic example in the same MSDN page shows it correctly but the C# example as given above is incorrect. I respect MSDN so much that I didn't care to see if anything is wrong in the code I lifted. After fiddeling around with a number of things and learning a whole lot than intended, I found the problem.
Lesson learnt! I will be more careful from next time

