That code was off the top of my head, so there may (is?) a better way. Regarding the compiler error, it wants a Type, therefore you need to pass typeof(AssemblyTitleAttribute) for the second parameter. I haven't tried the method that you're attempting, but that should appease the compiler.
HTH, Seang -----Original Message----- From: Ross Lambert [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 4:55 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] newbie question: How to read AssemblyTitle assembly attribute Sean, Thank you, your code worked nicely. It just seemed to me that something like this: Assembly asm = typeof(MyClass).Assembly; AssemblyTitleAttribute ata = Attribute.GetCustomAttribute(asm, AssemblyTitleAttribute); string title = ata.Title; ...should have also worked. Of course, the code above doesn't compile because GetCustomAttribute wants something else instead of AssemblyTitleAttribute as the second param. The docs say it is: attributeType The Type object to which the custom attributes are applied. But I can't quite yet figure out what it should be. Or am I barking up the wrong tree altogether? Thanks. == Ross == -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Sean Greer (SBI-Chico) Sent: Wednesday, April 17, 2002 10:10 AM 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. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.