CStr()与.ToString() [英] CStr() vs. .ToString()

查看:118
本文介绍了CStr()与.ToString()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读的书中说Cstr()是提高效率和安全性的最佳方法

然而它并没有比较.ToString()方法的方法。


哪个最好。


谢谢

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

推荐答案

恕我直言(这个问题一直争论不休现在一段时间了,你应该查看

所有旧的数据类型特定功能作为遗留功能,没有

更长时间使用它们。相反,使用更多面向对象的类型方法。


CStr,CBool​​,CDbl,CInt等都将被替换为CType或.ToString

所有日期/时间函数将被替换为

日期类的方法和属性

所有字符串函数将替换为
的方法和属性
String class。


et all。

" Sean" <硒** @ discussions.microsoft.com>在留言中写道

news:68 ********************************** @ microsof t.com ...
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" <Se**@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
我正在阅读的书中说Cstr()是提高效率和安全性的最佳方法
然而它并没有比较.ToString()方法的方法。 />
哪个最好。

谢谢
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



两个观点都有效,不过我使用vb字符串方法作为

编译器进行优化,可以提高本机.Net

方法的性能,同时我发现vb方法读得更好。


欢呼


家伙


" Scott M."写道:
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.

cheers

guy

"Scott M." wrote:
恕我直言(这已经讨论了很长一段时间了),你应该查看
所有旧的数据类型。具体功能作为遗留功能,没有更长时间使用它们。相反,使用更多面向对象的类型的方法。

CStr,CBool​​,CDbl,CInt等都将被替换为CType或.ToString
所有日期/时间函数将被替换为日期类的方法和属性
所有字符串函数都将替换为
String类的方法和属性。

等等。 />
" Sean" <硒** @ discussions.microsoft.com>在消息中写道
新闻:68 ********************************** @ microsof t.com。 ..
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" <Se**@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
我正在阅读的书中说Cstr()是提高效率和安全性的最佳方法
然而它并没有比较.ToString()方法的方法。

谢谢
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




我的澄清

..ToString()= native .Net方法

CStr()= vb字符串方法?


来自我的理解我正在阅读Cstr()等等,但它不会解决问题。但是它没有解决.ToString()


" guy"写道:
for my clarification
..ToString() = native .Net methods
CStr() = vb String methods?

from my understanding in the book I am reading Cstr() etc is the perfered
way however it doesnt address .ToString()

"guy" wrote:
两个观点都是有效的,但我使用vb字符串方法,因为
编译器进行的优化可以提高本机.Net的性能。
方法,我也发现vb方法读得更好。

欢呼



Scott M.写道:
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.

cheers

guy

"Scott M." wrote:
恕我直言(这已经讨论了很长一段时间了),你应该查看
所有旧的数据类型。具体功能作为遗留功能,没有更长时间使用它们。相反,使用更多面向对象的类型的方法。

CStr,CBool​​,CDbl,CInt等都将被替换为CType或.ToString
所有日期/时间函数将被替换为日期类的方法和属性
所有字符串函数都将替换为
String类的方法和属性。

等等。 />
" Sean" <硒** @ discussions.microsoft.com>在消息中写道
新闻:68 ********************************** @ microsof t.com。 ..
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" <Se**@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
我正在阅读的书中说Cstr()是提高效率和安全性的最佳方法
然而它并没有比较.ToString()方法的方法。

谢谢
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




这篇关于CStr()与.ToString()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆