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[]>>()
. 그럼에도 불구하고 이것이 아마도 누군가가 애초에 시도해야 할 일이 아니라는 것은 말할 필요도 없습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다