asp.net - How to convert Object to List in c#? -
asp.net - How to convert Object to List<string> in c#? -
i have list<string> in model. when write html helper, can info metadata.model, object
// mvc3 (namespace system.web.mvc -> modelmetadata), did not write // summary: // gets value of model. // // returns: // value of model. more info system.web.mvc.modelmetadata, // see entry asp.net mvc 2 templates, part 2: modelmetadata on brad wilson's // blog public object model { get; set; } my question is: how list<string> object?
if underlying type of object variable list<string>, simple cast do:
// throws exception if model not of type list<string> list<string> mymodel = (list<string>)model; or
// homecoming null if model not of type list<string> list<string> mymodel = model list<string>; c# asp.net list object
Comments
Post a Comment