Dictionary <string, Dictionary <T, T []> []> 생성

Furkle

C #에서 사전 배열을 값으로 포함하는 사전을 인스턴스화하고 초기화하는 구문은 무엇입니까?

예를 들어, (나는 믿는다)

Dictionary<string, Dictionary<string, string[]>[]>?

다음은 내가하려는 작업의 예입니다.

private static readonly Dictionary<string, Dictionary<string, DirectoryInfo[]>[]> OrderTypeToFulfillmentDict = new Dictionary<string, Dictionary<string, DirectoryInfo[]>>()
    {
        {"Type1", new [] 
                { 
                    ProductsInfo.Type1FulfillmentNoSurfacesLocations, 
                    ProductsInfo.Type2FulfillmentSurfacesLocations 
                } 
        }
    }

Type1Fulfillment ... 및 Type2Fulfillment ...는 이미 다음과 같이 구성되어 있습니다.

Dictionary<string, DirectoryInfo[]>. 

이로 인해 다음 컴파일러 오류가 발생합니다.

"Cannot convert from System.Collections.Generic.Dictionary<string, System.IO.DirectoryInfo[]>[] to System.Collections.Generic.Dictionary<string, System.IO.DirectoryInfo[]>"

편집 : 문제는 Lanorkin이 지적했듯이 []새로운 Dictionary<string, Dictionary<string, DirectoryInfo[]>>(). 그럼에도 불구하고 이것이 아마도 누군가가 애초에 시도해야 할 일이 아니라는 것은 말할 필요도 없습니다.

당신이 가지고있는 것은 정확 해 보이지만, 당신이하고있는 것은 심각한 기술적 부채 로 이어질 실제 코드 냄새 를 가지고 있습니다.

우선, Dictionary<string, string[]>모델링하려는 항목에 적합한 메소드를 사용하여 클래스에 내부 모델을 갖는 것보다 . 그렇지 않으면이 유형에 액세스하는 사람은 그것이 실제로 모델링하는 것이 무엇인지에 대한 단서를 갖지 못할 것입니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Dictionary <string, class> 생성

분류에서Dev

_t 필드를 생략 한 Dictionary <string, object> -to-BsonDocument 변환

분류에서Dev

Dictionary won't let me append a string to its values

분류에서Dev

Dictionary <string, T>를 반환하는 일반 / 건조한 방법

분류에서Dev

"즉석에서"Dictionary <T, T> 초기화

분류에서Dev

Dictionary <string, string> 값 조회 성능

분류에서Dev

Dictionary <string, object> 대 List <string> + BinarySearch의 성능

분류에서Dev

Dictionary (Of String, Object)를 Dictionary (Of String, String)로 변환

분류에서Dev

NSArray Returning String Instead of Dictionary

분류에서Dev

From string to Dictionary key and value

분류에서Dev

List <T>가 Dictionary <K, List <T >>와 어떻게 작동합니까?

분류에서Dev

From List<string> to Dictionary<string,string>

분류에서Dev

Find value in dictionary of type <string, string[]>

분류에서Dev

Dictionary <Path, Value>에서 JSON 생성

분류에서Dev

Dictionary <string, Dictionary <string, Dictionary <string, string >>>에서 containsKey를 확인하는 방법

분류에서Dev

Python can't add to dictionary, TypeError: list indices must be integers, not str

분류에서Dev

Python can't add to dictionary, TypeError: list indices must be integers, not str

분류에서Dev

데이터로 Dictionary <T, List <U >>를 초기화하는 방법

분류에서Dev

`Dictionary <string, Dictionary <string, List <MyCustomClass >>>`를`Dictionary <string, List <MyCustomClass >>`로 변환하는 방법

분류에서Dev

Python JSON Serialize Dictionary <String, Object>

분류에서Dev

Dictionary (Of String, Items)가있는 ContainsValue

분류에서Dev

Dictionary from a string skips new line character

분류에서Dev

Parsing a string with defined data dictionary into a list efficiently

분류에서Dev

Swift의 Dictionary <String, Any?>에서 동적으로 속성 설정

분류에서Dev

Anime 클래스의 속성에 대한 Intersecting Dictionary <string, List <Anime >>

분류에서Dev

LINQ, Dictionary <int, bool>을 Dictionary <string, string>으로 변환

분류에서Dev

Dictionary <string, dynamic>을 Dictionary <string, uint>로 변환하는 방법?

분류에서Dev

사전을 특성으로 사용하여 JSON을 역 직렬화하면 null .NET Dictionary <string, string>이 생성됩니다.

분류에서Dev

ServiceStack Json DeserializeFromString <Dictionary <string, string >> () 대 JsonObject.Parse ()

Related 관련 기사

  1. 1

    Dictionary <string, class> 생성

  2. 2

    _t 필드를 생략 한 Dictionary <string, object> -to-BsonDocument 변환

  3. 3

    Dictionary won't let me append a string to its values

  4. 4

    Dictionary <string, T>를 반환하는 일반 / 건조한 방법

  5. 5

    "즉석에서"Dictionary <T, T> 초기화

  6. 6

    Dictionary <string, string> 값 조회 성능

  7. 7

    Dictionary <string, object> 대 List <string> + BinarySearch의 성능

  8. 8

    Dictionary (Of String, Object)를 Dictionary (Of String, String)로 변환

  9. 9

    NSArray Returning String Instead of Dictionary

  10. 10

    From string to Dictionary key and value

  11. 11

    List <T>가 Dictionary <K, List <T >>와 어떻게 작동합니까?

  12. 12

    From List<string> to Dictionary<string,string>

  13. 13

    Find value in dictionary of type <string, string[]>

  14. 14

    Dictionary <Path, Value>에서 JSON 생성

  15. 15

    Dictionary <string, Dictionary <string, Dictionary <string, string >>>에서 containsKey를 확인하는 방법

  16. 16

    Python can't add to dictionary, TypeError: list indices must be integers, not str

  17. 17

    Python can't add to dictionary, TypeError: list indices must be integers, not str

  18. 18

    데이터로 Dictionary <T, List <U >>를 초기화하는 방법

  19. 19

    `Dictionary <string, Dictionary <string, List <MyCustomClass >>>`를`Dictionary <string, List <MyCustomClass >>`로 변환하는 방법

  20. 20

    Python JSON Serialize Dictionary <String, Object>

  21. 21

    Dictionary (Of String, Items)가있는 ContainsValue

  22. 22

    Dictionary from a string skips new line character

  23. 23

    Parsing a string with defined data dictionary into a list efficiently

  24. 24

    Swift의 Dictionary <String, Any?>에서 동적으로 속성 설정

  25. 25

    Anime 클래스의 속성에 대한 Intersecting Dictionary <string, List <Anime >>

  26. 26

    LINQ, Dictionary <int, bool>을 Dictionary <string, string>으로 변환

  27. 27

    Dictionary <string, dynamic>을 Dictionary <string, uint>로 변환하는 방법?

  28. 28

    사전을 특성으로 사용하여 JSON을 역 직렬화하면 null .NET Dictionary <string, string>이 생성됩니다.

  29. 29

    ServiceStack Json DeserializeFromString <Dictionary <string, string >> () 대 JsonObject.Parse ()

뜨겁다태그

보관