This project is read-only.

Determining the name of an assembly from a type.

Dec 14, 2009 at 4:08 PM

How would I go about determining the containing assembly of a type? In the following example, how would I determine the name of the assembly that defines Foo.Bar? Sorry if this questions has already been asked?

namespace Foo
{
    #region

     using System;
     using System.Collections;
     using System.Collections.Generic

    #endregion

    public class Bar
    {
         private int baz;

         public Bar()
         {
              this.baz = 0;
         }
    }
}

Dec 14, 2009 at 7:16 PM

TypeHelper.GetDefiningUnit(ITypeDefinition) and TypeHelper.GetDefiningUnitReference(ITypeReference) should do the trick for you.

Dec 14, 2009 at 9:01 PM

Excellent, that is exactly what I was looking for. Thanks!