我在Model中有一個List<string>
。 當我寫一個HTML輔助,我可以從metadata.Model
獲取數據,這是一個對象如何將對象轉換爲列表<string>在C#中?
// this is from MVC3 (namespace System.Web.Mvc -> ModelMetadata), I did not write this
// Summary:
// Gets the value of the model.
//
// Returns:
// The value of the model. For more information about System.Web.Mvc.ModelMetadata,
// see the entry ASP.NET MVC 2 Templates, Part 2: ModelMetadata on Brad Wilson's
// blog
public object Model { get; set; }
我的問題是:如何從一個Object
List<string>
?
什麼是對象的實際類型?將_any_對象轉換爲某些字符串列表是沒有意義的。 – 2012-01-28 07:53:48
你是說typecast? obj as List? –
zmbq
2012-01-28 07:53:50