Job Search
  |  Blog
  |  Contact
  |  Site Map
  |  Home
  |  

Extension Methods and Intellisense in VS 2008

Blog Date: Tuesday, October 7, 2008 - Discuss below!

Recent Blogs

<< Back

FTP files to website using Windows command prompt 9/16/2008

Unit Testing Mocking: Mock Builders, NMock vs RhinoMock 9/23/2008

LINQ: Writing Query Expressions in C# .NET 9/25/2008

 More Blogs...
 

IT Jobs Hiring


Business Intelligence Programmer Analyst North Chicago, IL

.NET Developer - PROVEN, Inc. San Diego, CA

UI/UX Position for Designer + Developer (Calabasas, CA ) Los Angeles Area, CA

More jobs...
 

Trying to create extension methods outside of the assembly. I see the methods in intellisense in Visual Studio 2008 ( .NET 3.5 ), but I get compile errors. Writing this in a hurry, but here's what I changed.

Assembly: A
Class: ParentClass

Assembly: B
Class: static ExtensionMethodClass
Methods: [static void Do(this ParentClass parent)] extends ParentClass of Assembly A

Assembly: C
Class: ChildClass Inherits from ParentClass, Assembly A

Tring to do this:
class ChildClass : ParentClass
{
  ChildClass()
  {
    base.Do();
  }
}

But, getting an error. This is how I fixed it:

1) In Assembly C, I  referenced both Assembly A and Assembly B

2) Changed to this:
class ChildClass : ParentClass
{
  ChildClass()
  {
    this.Do();
  }
}

And voila, it compiles! Huh? I don't know, but it does.
Adios, compadres!



Tuesday, October 07, 2008 5:56:24 PM