473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Explicit Conversion from Object to Reflection.AssemblyCompanyAttribute?

Help a newbie out. I cannot seem to explicitly convert an Object to a
Reflection.AssemblyCompanyAttribute type using DirectCast(). Turning Option
Strict "Off" is not an option.

Here is the Error:

Option Strict On disallows implicit conversions from 'System.Object' to
'System.Reflection.AssemblyCompanyAttribute'.

Here is the code:

Public ReadOnly Property Company() As String Implements
IAssemblyInfo.Company
Get
Dim attrCompany As SR.AssemblyCompanyAttribute
'*** The following line produces the conversion error ***
attrCompany =
Me._assemblyInfo.GetCustomAttributes(GetType(SR.As semblyCompanyAttribute),
False)(0)
Return attrCompany.Company.ToString

End Get
End Property

Any help is greatly appreciated.

carl
Nov 21 '05 #1
2 1386
Carl,
Try the following:

attrCompany = DirectCast( _
Me._assemblyInfo.GetCustomAttributes( _
GetType(SR.AssemblyCompanyAttribute), False)(0), _
SR.AssemblyCompanyAttribute)

Hope this helps
jay

"Carl Fenley" <clfenley-X-@-X-wcpci.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
| Help a newbie out. I cannot seem to explicitly convert an Object to a
| Reflection.AssemblyCompanyAttribute type using DirectCast(). Turning
Option
| Strict "Off" is not an option.
|
| Here is the Error:
|
| Option Strict On disallows implicit conversions from 'System.Object' to
| 'System.Reflection.AssemblyCompanyAttribute'.
|
| Here is the code:
|
| Public ReadOnly Property Company() As String Implements
| IAssemblyInfo.Company
| Get
| Dim attrCompany As SR.AssemblyCompanyAttribute
| '*** The following line produces the conversion error ***
| attrCompany =
| Me._assemblyInfo.GetCustomAttributes(GetType(SR.As semblyCompanyAttribute),
| False)(0)
| Return attrCompany.Company.ToString
|
| End Get
| End Property
|
| Any help is greatly appreciated.
|
| carl
|
|
Nov 21 '05 #2
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eJ**************@TK2MSFTNGP12.phx.gbl...
Carl,
Try the following:

attrCompany = DirectCast( _
Me._assemblyInfo.GetCustomAttributes( _
GetType(SR.AssemblyCompanyAttribute), False)(0), _
SR.AssemblyCompanyAttribute)

Hope this helps
jay


Thanks! That worked like a charm.

carl
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stub | last post by:
Docs says that "The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction." I put up code of three cases...
9
by: Tanmoy Bhattacharya | last post by:
Hi, This is a question about whether I am right that a particular syntactic sugar is missing in C++. Let me explain with an example. Let us say I have a class for complex numbers, and I want...
3
by: spamadress | last post by:
Hello I wonder why only constructors can be qualified with explicit to prevent implicit conversion, but not conversion operators. To me the following makes perfectly sense: struct A {...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
31
by: Michael C | last post by:
If a class inherits from another class, say Form inherits from control, then I can assign the Form to a variable of type Control without needing an explicit conversion, eg Form1 f = new Form1();...
11
by: Aaron Queenan | last post by:
Given the classes: class Class { public static implicit operator int(Class c) { return 0; } } class Holder
9
by: D.J. Stachniak | last post by:
Hi, I have a question about explicit constructors and the C++ standard. Forgive me for my laziness in not pouring over the spec myself, but I thought I'd ask first and read later. I have a...
14
by: Noone | last post by:
Hello all, Ok, I want to create a program that will load plugins (dll's) from a plugin folder. I can create the forms and put them into a dll but I cannot actually add them dynamically at run...
42
by: coder_lol | last post by:
Thanks everyone again for contributing to helping me clear C++ confusions. I did some serious reading on copy constructors and assignments and I think I've got a good handle on the memory stuff. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.