Home » c# » c# – Convert Task<Maybe<IEntity>> to Task<Maybe<IQueryable<TEntity>>>-Exceptionshub

c# – Convert Task<Maybe<IEntity>> to Task<Maybe<IQueryable<TEntity>>>-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I have tried to convert my response which is Task<Maybe<IEntity>> to Task<Maybe<IQueryable<TEntity>>>.

In my case, I have one method which is return response in Maybe<TEntity> form (means, it has value or no value). In the case of the object have no value it’s raise exception. However, I want to prevent that exception not by to throw a custom exception but object have no value, that time I want to perform another action.

Exception in below:

((CSharpFunctionalExtensions.Maybe)(new
System.Threading.Tasks.SystemThreadingTasks_FutureDebugView>(value).Result)).Value

How to&Answers: