Getting assembly company

  • Thread starter Thread starter Steve B.
  • Start date Start date
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
 
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.
 
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
 
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
 
Back
Top