Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convertion of ObjectResult<Nullable<int>> type to int

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

like image 217
safeena rasak Avatar asked Dec 01 '25 12:12

safeena rasak


1 Answers

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

like image 74
adjan Avatar answered Dec 03 '25 00:12

adjan