调用受保护的静态列表.. [英] Calling a protected static List..

查看:64
本文介绍了调用受保护的静态列表..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将方法调用为静态< list>,这是类的一部分,但是,我想不出从调用过程中读取此列表中的项目的方法,你能帮忙吗?



I am trying to have a method call a static <list>, that is part of a class, however, I cannot think of a way to read items within this list from a calling procedure, can you help?

protected static List<ContactDetailEmail> ContactDetailEmail = new List<ContactDetailEmail>();
    protected static List<ContactDetailFax> ContactDetailFax = new List<ContactDetailFax>();

推荐答案

更改name - 它很混乱,因为它在查找静态变量声明之前找到该名称的类定义:

Change the name - it is confused because it finds the class definition of that name before it looks for the static variable declaration:
    ...
    contactDetailEmail.Add(new ContactDetailEmail());
    contactDetailFax.Add(new ContactDetailFax());
    }
protected static List<ContactDetailEmail> contactDetailEmail = new List<ContactDetailEmail>();
protected static List<ContactDetailFax> contactDetailFax = new List<ContactDetailFax>();


这篇关于调用受保护的静态列表..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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