2017-09-25 25 views
1

我想要將列表中的輸出轉換爲webservice中的方法調用返回列表中的項目,並在此處返回數組中。如何將返回項目轉換爲C#中的數組中的列表

catalogueItems = dataService.GetCatalogItemsFromFile(fileFullPath); 

我需要這個dataService.GetCatalogItemsFromFile(fileFullPath)轉換成一個列表。我應該怎麼做?

回答

1

的方法有很多,這個人是不知道類型

var list = new[] { dataService.GetCatalogItemsFromFile(fileFullPath) }.ToList() 

如果你知道這是更好的類型:

var list = new List<YourType>{ dataService.GetCatalogItemsFromFile(fileFullPath) }; 
相關問題