Determining the name of an assembly from a type.

Dec 14, 2009 at 3: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

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


    public class Bar
         private int baz;

         public Bar()
              this.baz = 0;

Dec 14, 2009 at 6:16 PM

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

Dec 14, 2009 at 8:01 PM

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