簡體   English   中英

C# 字典沒有看到我的列表

[英]C# Dictionary doesn't see my List

我在另一堂課上有一節課。 在內部類中,我聲明了struct Impl。 在這個結構中有 IdxPointList,其中包括通用 Pair。 下面我創建字典,它以 uint 為鍵,上面的列表為值,但它不接受該列表。 我哪里錯了。

public class PointHash
            {
                struct Impl
                {
                    List<Pair<uint, Vector2D>> IdxPointList;
                    Dictionary<uint, IdxPointList> points;
                }
                Impl impl;
                public PointHash()
                {
                    impl = new Impl();
                }                    
    }

在此處輸入圖片說明

字典的聲明需要一個類型,而不是一個特定的變量:

Dictionary<uint, List<Pair<uint, Vector2D>>> points;

我已經更新了我使用 IdXPointList 類型的方式,方法是在類的頂部將其定義為用戶定義類型。

using IdxPointList= System.Collections.Generic.List<_3D.Helpers.slicingHelper.Pair<uint, MIRIA.Utility.Vector2D>>;


public class PointHash
{
    struct Impl
    {
        Dictionary<uint, IdxPointList> points;
    }
    Impl impl;
    public PointHash()
    {
        impl = new Impl();
    }                    
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM