1.    03 Feb 2009 #1
    Fernando Armburu Guest

    Reflection with Generic Collection types


    hi everybody,

    Im working on a very strange dotnet Reflection component and im having
    some troubles with reflection on generic types. To talk more concretely I
    will gvie you some examples of what im looking at.

    The method where Im having some troubles needs to do get the generic
    collection type from a generic collection variable. Examples (Please forget
    about namespaces, m not writing them just to be more clear)

    I have My Method
    should return
    List<int> List< >
    type instance
    Dictionary<string, object> Dictionary<> type
    instance

    By now I know how to get the parameter types (like int in the first
    example and string and object in the second one) and how to get something
    like List'1<int> or Dictionary'2<string, object> and I know I can parse the
    type name as a string and then everything is fixed but I think there is some
    whay to get what im looking at by using Reflection library. Can someone
    give me a hand?

    Thanks in advance.

    Fernando



      My System SpecsSystem Spec

  2.    03 Feb 2009 #2
    Cor Ligthert[MVP] Guest

    Re: Reflection with Generic Collection types


    Fernando,

    Are you sure you cannot simple set Option Strict to Off to get the same
    results without reflection?

    Cor

    "Fernando Armburu" <fernando@xxxxxx-group.com> wrote in message
    news:u1J7ZKghJHA.1184@xxxxxx

    > hi everybody,
    >
    > Im working on a very strange dotnet Reflection component and im
    > having
    > some troubles with reflection on generic types. To talk more concretely I
    > will gvie you some examples of what im looking at.
    >
    > The method where Im having some troubles needs to do get the generic
    > collection type from a generic collection variable. Examples (Please
    > forget
    > about namespaces, m not writing them just to be more clear)
    >
    > I have My Method
    > should return
    > List<int> List< >
    > type instance
    > Dictionary<string, object> Dictionary<> type
    > instance
    >
    > By now I know how to get the parameter types (like int in the first
    > example and string and object in the second one) and how to get something
    > like List'1<int> or Dictionary'2<string, object> and I know I can parse
    > the
    > type name as a string and then everything is fixed but I think there is
    > some
    > whay to get what im looking at by using Reflection library. Can someone
    > give me a hand?
    >
    > Thanks in advance.
    >
    > Fernando
    >
    >
    >
      My System SpecsSystem Spec

  3.    03 Feb 2009 #3
    Cor Ligthert[MVP] Guest

    Re: Reflection with Generic Collection types


    Sorry,

    I thought that I was answering from the VB newsgroup.

    Cor

    "Fernando Armburu" <fernando@xxxxxx-group.com> wrote in message
    news:u1J7ZKghJHA.1184@xxxxxx

    > hi everybody,
    >
    > Im working on a very strange dotnet Reflection component and im
    > having
    > some troubles with reflection on generic types. To talk more concretely I
    > will gvie you some examples of what im looking at.
    >
    > The method where Im having some troubles needs to do get the generic
    > collection type from a generic collection variable. Examples (Please
    > forget
    > about namespaces, m not writing them just to be more clear)
    >
    > I have My Method
    > should return
    > List<int> List< >
    > type instance
    > Dictionary<string, object> Dictionary<> type
    > instance
    >
    > By now I know how to get the parameter types (like int in the first
    > example and string and object in the second one) and how to get something
    > like List'1<int> or Dictionary'2<string, object> and I know I can parse
    > the
    > type name as a string and then everything is fixed but I think there is
    > some
    > whay to get what im looking at by using Reflection library. Can someone
    > give me a hand?
    >
    > Thanks in advance.
    >
    > Fernando
    >
    >
    >
      My System SpecsSystem Spec

  4.    09 Feb 2009 #4
    Fernando Armburu Guest

    Re: Reflection with Generic Collection types


    No problem Cor. Thanks anyway.

    Fernando

    "Cor Ligthert[MVP]" <Notmyfirstname@xxxxxx> escribi en el mensaje
    news:ODslEqjhJHA.5732@xxxxxx

    > Sorry,
    >
    > I thought that I was answering from the VB newsgroup.
    >
    > Cor
    >
    > "Fernando Armburu" <fernando@xxxxxx-group.com> wrote in message
    > news:u1J7ZKghJHA.1184@xxxxxx

    >> hi everybody,
    >>
    >> Im working on a very strange dotnet Reflection component and im
    >> having
    >> some troubles with reflection on generic types. To talk more concretely I
    >> will gvie you some examples of what im looking at.
    >>
    >> The method where Im having some troubles needs to do get the generic
    >> collection type from a generic collection variable. Examples (Please
    >> forget
    >> about namespaces, m not writing them just to be more clear)
    >>
    >> I have My
    >> Method
    >> should return
    >> List<int> List< >
    >> type instance
    >> Dictionary<string, object> Dictionary<> type
    >> instance
    >>
    >> By now I know how to get the parameter types (like int in the first
    >> example and string and object in the second one) and how to get something
    >> like List'1<int> or Dictionary'2<string, object> and I know I can parse
    >> the
    >> type name as a string and then everything is fixed but I think there is
    >> some
    >> whay to get what im looking at by using Reflection library. Can someone
    >> give me a hand?
    >>
    >> Thanks in advance.
    >>
    >> Fernando
    >>
    >>
    >>
    >

      My System SpecsSystem Spec


Similar Threads
Thread Forum
How to retrieve a generic method with GetMethod (reflection) ?
How to retrieve a generic method with GetMethod ? #public static void Sort<T>( T array, Comparison<T> comparison) $Methode =...
PowerShell
Question on Reflection
I have a C#.NET project that passes two parameters to an external S- PLUS function that outputs a value. In my C#.NET project, I'll also need to...
.NET General
reflection, COM, and Vista
Hi all, I've been struggling with an issue that I hope you can comment on or provide suggestions to. Our .NET 2.0 (VS2005) based product is...
.NET General
Converting proxy generated types to original types
I have a WCF Service called "MyService". It references a DLL that defines a type called "SomeLib.MyType". "SomeLib.MyService" exposes the...
Indigo
How to Create Collection Generic Class using new-object
For example in C# it is like using System.Net; System.Collections.ObjectModel.Collection<IPAddress> IPs = new...
PowerShell
3d Reflection effects
Hello, I'm trying to achieve some mirror effects like those seen here: http://www.microsoft.com/max/ From Adam Smith's post a while back, he...
Avalon
Re: reflection with a viewport3D
Hi Adam, thanks for the reply. I'm a newb with 3d, so to quickly summarize your last post: Two main ways to achieve mirror 3d effects: 1) Add...
Avalon

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 04:59.
    .