如何获得该收藏列表的属性< struct> [英] How do I get property that collection list<struct>

查看:137
本文介绍了如何获得该收藏列表的属性< struct>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是代码.

我想在其他班级获得mManagementPort!

Here is the code.

I want to get mManagementPort in other class!

class GetConfig
public struct structManagementPort
        {
            public UInt16 PortFrom;
            public UInt16 PortTo;

            public structManagementPort(UInt16 pfrom, UInt16 pto)
            {
                PortFrom = pfrom;
                PortTo = pto;
            }
        }

List<structManagementPort> mManagementPort = new List<structManagementPort>();


public List<structManagementPort> ManagementPort
        {
            get { return this.mManagementPort; }
        }







class ReceiveConfig

 GetConfig getConfig = new GetConfig();
 ????? = getCongig.ManagementPort;



mManagementPort是List< userdefinestruct> !!!
* UserDefineStruct-> structManagementPort


我该如何解决这个问题...
那里有什么''????????''....ㅠ_ㅠPlz帮助...谢谢..

我尝试过的事情:

eeeeeeeeeeeevrythinggggggggggggggggg



mManagementPort is List<userdefinestruct> !!!
* UserDefineStruct --> structManagementPort


How can I Solve this problem...
what is there ''?????'' ....ㅠ_ㅠ Plz help... thanks..

What I have tried:

eeeeeeeeeeeevrythinggggggggggggggggg

推荐答案

不是所有内容...
Not everything...
class ReceiveConfig
    {
    void myMethod()
        {
        GetConfig getConfig = new GetConfig();
        List<GetConfig.structManagementPort> x = getConfig.ManagementPort;
        }
    }


或者,

Or,

class ReceiveConfig
    {
    void myMethod()
        {
        GetConfig getConfig = new GetConfig();
        var x = getConfig.ManagementPort;
        }
    }



这就是你想要的吗?

如果这不能解决您的问题,请发表评论,我将通过改善我的解决方案来帮助您,直到您的问题得到解决.

干杯,
AH



Is this what you want?

If this did not solve your problem then please leave a comment and I will assist you by improving my solution until your problem gets solved.

Cheers,
AH


这篇关于如何获得该收藏列表的属性&lt; struct&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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