Kodefu
Hone your software combat skills with kodefu.
I recently came across a piece of code that had almost every parameter for every method marked with the ref keyword. This keyword is primarily used to pass a value type by reference, but this one even had reference types marked with the keyword. This made me wonder, why exactly would you ever want to pass a reference type as a ref parameter? Read More...
Taking advantage of language features can make sleeker, easier to maintain code. One of these language features are array initializers. Have you ever created an array, then assigned each element in the array? This incurs many lines of code with no tangible benefit. Check out this code from the NameMangler class in LINQ to XSD. Read More...
It appears that my blog post on Friday wasn't saved. This is kind of bizarre. You can catch back up on it at my website. Stop Using Structs Everywhere And I posted a follow-up today: More On Structs
We've all been told to think of a dynamic object as a regular object but with dynamic behavior. Kevin Hazzard peeked behind the curtain to show that the compiler is actually doing a lot with that keyword; it isn't just an object. It does change the type to an object, but then it builds CallSites everywhere that object is referenced. These CallSites handle the calls to the dynamic language runtime. That's great, but we have an object. How does a consumer of your class library know that a property...
If you've ever needed to host a PDF in a windows form application, the easiest way to do so is by using the ActiveX control provided by Adobe Acrobat. Accessing it is easy: Right click the toolbox, select Choose Items, select COM Components, then check Adobe PDF Reader. The Adobe PDF Reader control now shows up in your toolbox under the General tab. You can move this to a different tab by dragging and dropping. If you drag this to your Windows Form, it now acts like a regular control. Its default...
When creating a designer for Visual Studio, you may want to allow editing in the properties pane. This took me a while to figure out how to do, because the terminology wasn't quite what I expected it to be. Here's how I accomplished this task. The window pane that hosts the designer implements IVsWindowPane. This interface contains a method called SetSite, which will provide a pointer to an object that implements IServiceProvider. I instantiate a ServiceProvider and assign this to a ServiceProvider...
Mike Ormond has announced that Visual Studio Beta 1 (including .NET Fx 4.0) will be available to MSDN subscribers later today. He also posted a few screenshots. I admit that I'm somewhat saddened by the removal of the triangles...
Yesterday, I wrote about running GacUtil from within the AfterBuild target, due to some constraints with MPF and T4. I discovered that the path I provided was wrong. It's the only GacUtil.exe under the Microsoft.NET folder, but it won't register the assembly. Since I wasn't sure which path I should be using, I used the GacUtil task from MSBuild Community Tasks. Here is the relevant code it uses to retrieve the path to gacutil.exe: protected override string GenerateFullPathToTool() { return ToolLocationHelper.GetPathT...
Due to circumstances involving a MPF package and Text Templating (t4), I had to add an assembly to the GAC after compiling if I wanted to be able to run the generator in the VS Experimental. So, I added the following line to the AfterBuild target of the csproj file: <Exec Command="gacutil /i $(TargetPath)"/> Unfortunately, I received the following error when I compiled: Error 155 The command "gacutil /i [PathToDll]" exited with code 9009. C:\Projects\AperioVisualStu...
Brian Harry has posted a list of features that will be in the upcoming beta 1 of Visual Studio 2010 Team System. Unfortunately, the date of release for beta 1 has not been announced yet. Architecture (http://blogs.msdn.com/came... Architecture Explorer Layer diagram Use case designer Activity designer Component diagram Logical class designer Sequence diagram Modeling project system UML Model explorer Architecture validation during build Development & Database (http://blogs.msdn.com/habi...
Full Kodefu Archive