c# - Cannot Implicity convert type of an object to an system.collection.generic.IEnumerable -
error cs0266 cannot implicitly convert type 'vidly.models.hotelinformation' 'system.collections.generic.ienumerable<vidly.models.hotelinformation>'. explicit conversion exists (are missing cast?)
i receiving error when running application. have written
hotel = new hotelinformation()
(where receiving error)
in view model writing
public ienumerable<hotelinformation> hotel { get; set; }
i've looked @ other solutions, didn't seem work.
your property of type ienumerable<hotelinformation>
. trying set value of type hotelinformation
. error states, types different.
if want set property list, create new list. like:
hotel = new list<hotelinformation>();
conversely, if want set single instance of hotelinformation
make property type:
public hotelinformation hotel { get; set; }
which solution should use , want property be. (though name implies should single instance.)
Comments
Post a Comment