请问这种情况用什么类实现好
我在做一个即时数据统计,未每一个用户定义了个类
Public Class User Property UserName As String'用户帐号 独一无二的 Property Move As Int64 Property Stop As Int64End Class'我现在想定义一个用户类的集合 如Users'只要我输入 Users.Item("用户帐号") 就能获取到相应的User数据应该怎么弄?'用什么系统内置类来做好点? 本来想自己写一个类用循环对比来实现 但是怕循环过程耗时太长导致计算不准确
public class Users private mUserList as hashtable public sub new(byval userList as IList) '这里你得将所有的 USER 集合 ADD 到 mUserList for each user as User in userList mUserList.add(user.id, user) next end sub public function Item(byval userId as Integer) as User dim user as new User user = mUserList.Item(userId) return user end functionend class
[解决办法]
继承Dictionary