温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

VB.NET中有哪些特殊操作符

发布时间:2021-07-15 11:36:02 阅读:113 作者:Leah 栏目:编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇文章将为大家详细讲解有关VB.NET中有哪些特殊操作符,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

VB.NET特殊操作符的小例子如下:

Dim a As New dog   Dim b As New dog   Dim c As Type   c = a.GetType   MsgBox(c.ToString)   If TypeOf (a) Is vb1.Form7.dog Then   MsgBox(True)   End If   'vb1.Form7+dog   'True  

就说这么多吧。已有在应用中如果在总结出什么好的经验,再慢慢补充。

任何一门语言都提供了丰富的操作符,vb也不例外。操作符一般分为:算术运算符,赋值运算符,比较运算符,逻辑运算符,以及VB.NET特殊操作符。本文只以几个小例子来介绍其中一些比较重要的应用。

在本文中将会用到一个自定义类 dog ,代码如下:

Public Class dogClass dog   Private s_name As String   Private s_color As Color   Private s_age As Integer   Public Sub New()Sub New()   s_name = "塞北的雪"   s_age = 22   s_color = System.Drawing.Color.Red   End Sub   Public Property Name()Property Name() As String   Get   Return s_name   End Get   Set(ByVal value As String)   s_name = value   End Set   End Property   Public Property Color()Property Color() As Color   Get   Return s_color   End Get   Set(ByVal value As Color)   s_color = value   End Set   End Property   Public Property Age()Property Age() As Integer   Get   Return s_age   End Get   Set(ByVal value As Integer)   s_age = value   End Set   End Property   Public Shared Operator +(ByVal a As dog, ByVal b As dog)   Dim c As New dog   c.Name = a.Name + b.Name   c.Age = a.Age + b.Age   c.Color = Color.FromArgb((a.Color.ToArgb + b.Color.ToArgb) / 2)   Return c   End Operator   End Class  

关于VB.NET中有哪些特殊操作符就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×