WilliamSullivan
Tue Nov 23 20:29:05 CST 2004
Okay, so what's the "fully qualifed with the partial or complete assembly
name" of ListViewItem? I'm interested because I thought that
"System.Windows.Forms.ListViewItem" was fully qualified.
"Jon Skeet [C# MVP]" wrote:
> William Sullivan <WilliamSullivan@discussions.microsoft.com> wrote:
> > I'm wondering why reflection fails in this instance... I'm trying to do drag
> > and drop using ListViewItem objects. When I check the DragEventArgs to see
> > if it has my ListViewItem, I have to use GetDataPresent to test if it's the
> > data I'm looking for. I have to pass a System.Type object representing the
> > type of a ListViewItem object. But I've found that Type fails to correctly
> > identify a ListViewItem. If I try this:
> > Type f = Type.GetType("System.Windows.Forms.ListViewItem");
> > f is null. According to MSDN, this should work, as their sample is this:
> > Type myType1 = Type.GetType("System.Int32");
> >
> > Am I wrong? What's going on?
>
> You're wrong, because you didn't spot the bit of the documentation
> which states:
>
> <quote>
> If typeName includes only the name of the Type, this method searches in
> the calling object's assembly, then in the mscorlib.dll assembly. If
> typeName is fully qualified with the partial or complete assembly name,
> this method searches in the specified assembly.
> </quote>
>
> Int32 is part of mscorlib; ListViewItem isn't.
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>