Home All Groups Group Topic Archive Search About

What is the return type of Session("Something")?

Author
18 Dec 2006 9:03 AM
marcwentink
This probably is a very noob question
What is the return type of Session("Something")?

I want to change:

        If Not Session("Name") Is Nothing Then
            LoginId = Session("Name").ToString


to something like

        MyObject = Session("Name")
        If Not MyObject Is Nothing Then
            LoginId = MyObject.ToString

Author
18 Dec 2006 9:10 AM
Stephany Young
Object


<marcwent***@hotmail.com> wrote in message
Show quoteHide quote
news:1166432612.416862.316570@t46g2000cwa.googlegroups.com...
> This probably is a very noob question
> What is the return type of Session("Something")?
>
> I want to change:
>
>        If Not Session("Name") Is Nothing Then
>            LoginId = Session("Name").ToString
>
>
> to something like
>
>        MyObject = Session("Name")
>        If Not MyObject Is Nothing Then
>            LoginId = MyObject.ToString
>
Author
18 Dec 2006 11:33 AM
marcwentink
Stephany Young schreef:

> Object

Works, including the ToString call, which would be a polymorphic call
from a general reference I presume? Or is the Object type really a
Session Object type and not a general root for all Objects in VB, and
not like Object in Java?

Thanks a lot!
Author
18 Dec 2006 12:05 PM
Stephany Young
Every type is derived from type Object.

Object exposes a ToString() method therefore every type exposes a ToString()
method.

You can cast the returned object as type session:

    Dim mySession As Session = CType(returnedObject, Session)


<marcwent***@hotmail.com> wrote in message
Show quoteHide quote
news:1166441622.747103.305970@l12g2000cwl.googlegroups.com...
>
> Stephany Young schreef:
>
>> Object
>
> Works, including the ToString call, which would be a polymorphic call
> from a general reference I presume? Or is the Object type really a
> Session Object type and not a general root for all Objects in VB, and
> not like Object in Java?
>
> Thanks a lot!
>
Author
18 Dec 2006 1:51 PM
marcwentink
Stephany Young schreef:

> Every type is derived from type Object.

Hey, just to confirm, this is then a .NET property I think, not in VB
but in C# also, all objects are derived from type Object. Is that
correct?

As you might suggest, I am fairly new to .NET.

And thanks again, learned another little piece of .NET today.