.NETGURU
Type.FullName returns malformed name
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vb.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

George
I declared an enumeration inside an interface. Trying to use reflection to
find the FullName of the enumeration type produces

"WindowsApplication1.IGeorge+GeorgeConstants"

rather than

"WindowsApplication1.IGeorge.GeorgeConstants"

as I (and the rest of the framework) would expect.

My code is as follows (start a new VB Windows app, add the Interface and the
call to Msgbox into the Form_Load, hit F5):

Public Interface IGeorge
Enum GeorgeConstants
GeorgeConstant1
GeorgeConstant2
GeorgeConstant3
End Enum
End Interface

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
:
#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MsgBox(GetType(IGeorge.GeorgeConstants).FullName)
End Sub

End Class

George.

Reply to this message...
 
    
Herfried K. Wagner [MVP] (VIP)
* "George" <Click here to reveal e-mail address> scripsit:
[Original message clipped]

Notice that the type 'GeorgeConstants' is defined /inside/ 'IGeorge', so
it's a nested type. Nested types are indicated with a "+" separator
instead of ".". If you don't want 'GeorgeConstants' to be a nested
type, take its code and place it somewhere outside your interface.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Reply to this message...
 
    
Jay B. Harlow [MVP - Outlook] (VIP)
George,
As the others suggest + is the delimiter for nested types.

For details see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassassemblyqualifiednametopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconSpecifyingFullyQualifiedTypeNames.asp

Hope this helps
Jay

"George" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
George
Thanks, I've now read up about the (many) delimiters. I never realised there
were so many. Makes sense once you know why though.

The problem occurred in a third party grid product that was bound to a
DataTable containing a field of an Enum type. When the grid tried to convert
its display value to the underlying enum type it used reflection to get the
target type and then some sort of conversion procedure which doesn't
understand the '+'. I've changed my code to use the underlying primitive
type in the DataTable (Int32 for Enum types), pending a fix from the third
party.

George

"Jay B. Harlow [MVP - Outlook]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Dot Net Guruias Sjögren
[Original message clipped]

Reflection uses + as the delimiter between a nested class and its
encloser. Nothing wrong there.

Dot Net Guruias

--
Dot Net Guruias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Reply to this message...
 
 
System.Data.DataTable
System.EventArgs
System.Object
System.Windows.Forms.Form




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification