convertion of ObjectResult> type to int

asp.net-mvc-5 c# entity-framework-6

Question

Stored proc return as ObjectResult<Nullable<int>> using Entity frame work and want to convert this to int type or how to check this value with another integer value

1
0
6/5/2017 6:54:49 AM

Popular Answer

You have to loop over the ObjectResult<T> or use ObjectResult<T>.ElementAt() to retrieve individual elements. Then you can access the int values:

ObjectResult<Nullable<int>> queryResult = query.Execute(...);

foreach (Nullable<int> result in queryResult)
   Console.WriteLine("{0}", result.Value);

You can check if a value is available using ObjectResult<T>.HasValue

3
6/5/2017 7:11:25 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow