views:

84

answers:

2

I just need another pair of eyes... I don't see anything wrong with the following. In fact, I swear I had something just like this not long ago, and it worked.

In my Collections.dll:

namespace Collections
{
   public class CSuperAutoPool
   {
      public static CSuperAutoPool ActivateByType(Type typeToBeActivated, params object[] activatedArguments)
      {
          //...
      }
   }
}

In another DLL, I have referenced the collections DLL project, and use it in this function:

namespace Organization
{
    public class CBaseEntity : CSuperAutoPool
    {
        protected static CBaseEntity Create()
        {
            //...
            CBaseEntity created = (CBaseEntity)CSuperAutoPool.ActivateByType(callingType); //Error here.
            //...
        }
    }
}

Error: 'Collections.CSuperAutoPool' does not contain a definition for 'ActivateByType'

I have used ActivateByType, within CSuperAutoPool, in a different function, and that one does not have errors. The Collections DLL compiles without errors. In the same DLL where the Organization namespace exists, have used various other aspects of the CSuperAutoPool class in other ways, without compiler errors.

+3  A: 

There must be something missing from your example, or you are not using the version of the code that you think you are using, e.g. could it be that there is another class called CSuperAutoPool in your project, possibly in a referenced assembly?

The following snippets compiles without errors:

namespace Collections
{
    public class CSuperAutoPool
    {
        public static CSuperAutoPool ActivateByType(
            Type typeToBeActivated, params object[] activatedArguments)
        {
            //...
            return null;
        }
    }
}

namespace Organization
{
    using Collections;
    public class CBaseEntity : CSuperAutoPool
    {
        protected static CBaseEntity Create()
        {
            Type callingType = null;
            //...
            CBaseEntity created = 
                (CBaseEntity)CSuperAutoPool.ActivateByType(callingType); 
            //...
            return created;
        }
    }
}
0xA3
A: 

Found it! 0xA3 gave me the hint I needed with: "you are not using the version of the code that you think you are using"

When I added the Collections reference to the Organization project, it did not checkmark the Collections project to compile in the Configurations Manager. In other words, my Collections DLL was not compiling unless I did it by hand.

Thank you, that's what I meant by an extra set of eyes. :-)

JnZ
Please mark this as the answer.
JnZ