|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What is the return type of Session("Something")?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 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 > Stephany Young schreef:
> Object Works, including the ToString call, which would be a polymorphic callfrom 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! 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! > Stephany Young schreef:
> Every type is derived from type Object. Hey, just to confirm, this is then a .NET property I think, not in VBbut 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. |
|||||||||||||||||||||||