Are you making sure that the attribute you're trying to read is an
assembly level attribute? For example it should be in the form of:

[assembly: MyAttribute("hello")]

Brian

-----Original Message-----
From: Sean Greer (SBI-Chico) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 17, 2002 1:10 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] newbie question: How to read AssemblyTitle
assembly attribute


This work for me:

Assembly asm = Assembly.GetExecutingAssembly();
object[] atts = asm.GetCustomAttributes(false);

//find the AssemblyTitleAttribute
for(int n = 0; n < atts.Length; n++)
{
        if(atts[n] is AssemblyTitleAttribute)
        {
                AssemblyTitleAttribute ata = (AssemblyTitleAttribute)
atts[n];
                Console.WriteLine(ata.Title);
                break;
        }
}

//Seang

-----Original Message-----
From: Ross Lambert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 9:36 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET] newbie question: How to read AssemblyTitle assembly
attribute


DotNetters,

I'm bumfuzzled... I can read a custom class attribute but can't seem to
do the same for the assembly that contains it.

Anybody got that off the top of their 'ead? The attribute I'm looking
for in particular is the AssemblyTitle.

Thanks.

== Ross ==

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to