简体   繁体   English

课堂上有新财产吗?

[英]New property in class?

Well, my question is simple. 好吧,我的问题很简单。

I want to add a property to a pre - defined class. 我想将属性添加到预定义的类中。

Imports Lidgren.Network

Module Socket
    Public Clients As List(Of NetConnection) = New List(Of NetConnection)

Need to add the "index " property , so that it is " Clients (sender ) .Index " 需要添加“ index”属性,使其为“ Clients(sender).Index”

您使用List(Of T)因此可以访问它的IndexOf方法 -它返回集合中从零开始的位置。

Dim i As Integer = Clients.IndexOf(sender)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM