Getting assembly company

S

Steve B.

Hi,

I'm trying to get the company attribute of an assembly (CF 1.0) using this
code :

public string AssemblyCompany
{
get
{
Attribute attr = Attribute.GetCustomAttribute(
this._assembly,
typeof(AssemblyCompanyAttribute)
);
if(attr != null)
{
return ((AssemblyCompanyAttribute)attr).Company;
}
else
{
return null;
}
}
}

This code throw a "NotSupportedException" on the line with
..GetCustomAttribute...

What is wrong ?
Thank,s
Steve
 
S

Sergey Bogdanov

Since the static method GetCustomAttributes(Assembly element, Type
attributeType, bool inherit) is not supported by CF.NET 1.0 and the
method GetCustomAttribute(Assembly element, Type attributeType) uses it,
you have got that exception.
 
S

Steve B.

I see, but is there any other way to reach my goal ?

Steve
Sergey Bogdanov said:
Since the static method GetCustomAttributes(Assembly element, Type
attributeType, bool inherit) is not supported by CF.NET 1.0 and the method
GetCustomAttribute(Assembly element, Type attributeType) uses it, you have
got that exception.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Hi,

I'm trying to get the company attribute of an assembly (CF 1.0) using
this code :

public string AssemblyCompany
{
get
{
Attribute attr = Attribute.GetCustomAttribute(
this._assembly,
typeof(AssemblyCompanyAttribute)
);
if(attr != null)
{
return ((AssemblyCompanyAttribute)attr).Company;
}
else
{
return null;
}
}
}

This code throw a "NotSupportedException" on the line with
.GetCustomAttribute...

What is wrong ?
Thank,s
Steve
 
S

Sergey Bogdanov

Sorry, no - as I said it's not supported.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

I see, but is there any other way to reach my goal ?

Steve
Since the static method GetCustomAttributes(Assembly element, Type
attributeType, bool inherit) is not supported by CF.NET 1.0 and the method
GetCustomAttribute(Assembly element, Type attributeType) uses it, you have
got that exception.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Hi,

I'm trying to get the company attribute of an assembly (CF 1.0) using
this code :

public string AssemblyCompany
{
get
{
Attribute attr = Attribute.GetCustomAttribute(
this._assembly,
typeof(AssemblyCompanyAttribute)
);
if(attr != null)
{
return ((AssemblyCompanyAttribute)attr).Company;
}
else
{
return null;
}
}
}

This code throw a "NotSupportedException" on the line with
.GetCustomAttribute...

What is wrong ?
Thank,s
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top