Re: CStr() vs. .ToString()
- From: "Scott M." <s-mar@xxxxxxxxxxxxx>
- Date: Sat, 18 Feb 2006 17:02:37 -0500
"guy" <guy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2199BA10-0B41-4D7D-B7AF-F34D469457BD@xxxxxxxxxxxxxxxx
both points of view are valid, however i use the vb string methods as the
compiler makes optimzations that can improve performance over the native
.Net
methods, also i find the vb methods read better.
The VB 6.0 way are not methods, they are functions. The .NET way are object
methods. The VB.NET compiler does NOT optimize the VB 6.0 functions to work
BETTER than the natvie .NET object methods.
To answer your question, ToString would be my suggestion, rather than
CStr(). ToString is a method of the Object Type, and since all classes
inherit from Object, all objects have this method.
cheers
guy
"Scott M." wrote:
IMHO (and this has been debated for quite some time now), you should view
all of the old "data-type" specific functions as legacy functions and no
longer use them. Instead, use the more object-oriented methods of a
type.
CStr, CBool, CDbl, CInt, etc. would all be replaced with CType or
.ToString
All date/time functions would be replaced with methods and properties of
the
Date class
All string functions would be replaced with methods and properties of the
String class.
et all.
"Sean" <Sean@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:68FBFD12-1AF2-4F12-821F-2CC4E6F8E957@xxxxxxxxxxxxxxxx
Book I am reading says that Cstr() is best method for efficency and
safety
however it doesnt compare that method of the .ToString() method.
Which is best.
Thanks
.
- Follow-Ups:
- Re: CStr() vs. .ToString()
- From: Cor Ligthert [MVP]
- Re: CStr() vs. .ToString()
- From: Herfried K. Wagner [MVP]
- Re: CStr() vs. .ToString()
- From: CMM
- Re: CStr() vs. .ToString()
- References:
- Re: CStr() vs. .ToString()
- From: Scott M.
- Re: CStr() vs. .ToString()
- Prev by Date: Re: Least Cost Formulations and Linear Programming
- Next by Date: Re: CStr() vs. .ToString()
- Previous by thread: Re: CStr() vs. .ToString()
- Next by thread: Re: CStr() vs. .ToString()
- Index(es):
Relevant Pages
|