What is equivelant to VB.NET GetType()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Billingsley

    What is equivelant to VB.NET GetType()

    Using this keyword in VB I can do

    Dim typeData As Type = GetType(myClass )

    which returns a Type of course. I can't find quite the same thing in C# or
    the framework.

    Will the following meet the needs like the above VB code? (If so, then why
    the keyword in VB???)

    Type typeData = Type.GetType("m yClass")


  • Zoury

    #2
    Re: What is equivelant to VB.NET GetType()

    Hi Daniel!

    use typeof()

    --
    Best Regards
    Yanick Lefebvre

    Please posts answers to the group so all can benefit


    Comment

    • Bret Mulvey [MS]

      #3
      Re: What is equivelant to VB.NET GetType()

      If "myClass" is the name of your class, you can use typeof(myClass) . If
      it's an instance of your class, you can use myClass.GetType ().

      "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
      news:eI62PUsqDH A.488@tk2msftng p13.phx.gbl...[color=blue]
      > Using this keyword in VB I can do
      >
      > Dim typeData As Type = GetType(myClass )
      >
      > which returns a Type of course. I can't find quite the same thing in C#[/color]
      or[color=blue]
      > the framework.
      >
      > Will the following meet the needs like the above VB code? (If so, then[/color]
      why[color=blue]
      > the keyword in VB???)
      >
      > Type typeData = Type.GetType("m yClass")
      >
      >[/color]


      Comment

      • Daniel Billingsley

        #4
        Re: What is equivelant to VB.NET GetType()

        Thanks to both of you, that worked poifect.

        Pardon me for being a bit misleading... I should have used MyClass as I
        indeed meant to refer to the class, not an instance object.

        "Bret Mulvey [MS]" <bretm@online.m icrosoft.com> wrote in message
        news:%23TELxYsq DHA.688@TK2MSFT NGP10.phx.gbl.. .[color=blue]
        > If "myClass" is the name of your class, you can use typeof(myClass) . If
        > it's an instance of your class, you can use myClass.GetType ().
        >[/color]


        Comment

        Working...