Visual Basic中的声明问题 [英] declaration problem in visual basic

查看:75
本文介绍了Visual Basic中的声明问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决这个问题.为什么在声明  VISUAL BASIC的整数变量时,可以使用  integer.parse但不能在声明字符串变量时使用string.parse .我被告知它不是字符串成员 所以我可能知道字符串成员

Pleas,help me out with this issue.why is it that in declaring an integer variable of  VISUAL BASIC,you can make use of  integer.parse but cant make use of string.parse when declaring a string variable.I was informed it is not a string member so may I know the string members

推荐答案

请帮我解决这个问题.为什么在声明  VISUAL BASIC的整数变量时,您可以使用  integer.parse,但在声明字符串变量时不能使用string.parse.我被告知它不是字符串 成员,所以我可以知道字符串成员
Pleas,help me out with this issue.why is it that in declaring an integer variable of  VISUAL BASIC,you can make use of  integer.parse but cant make use of string.parse when declaring a string variable.I was informed it is not a string member so may I know the string members

从未为String类定义解析方法,可能是因为它没有多大意义.对于整数,它确认可以从字符串创建有效的整数.对于一个字符串,它已经是一个字符串,因此 什么都没创建.

A parse method has never been defined for the String class, probably because it doesn't make much sense.   For an integer, it confirms that a valid integer can be created from the string.  For a string it's already a string, so there is nothing to be created.

 您希望字符串解析方法做什么?您始终可以将自己的parse方法创建为扩展方法,也可以将String类作为子类来创建自己的版本.

 What would you expect a string parse method to do?   You can always create your own parse method as an extension method, or you can subclass the String class to create you own version.


这篇关于Visual Basic中的声明问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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