Methods to be added in the Result class to perform the conversion from Result to:
public Result<T> ToResult<T>(T data);
public ListedResult<T> ToListedResult<T>(IEnumerable<T> data);
public PagedResult<T> ToPagedResult<T>(IEnumerable<T> data, PagedInfo pagedInfo);
These methods can go in a file named Result.Conversions.cs.
Note: Implicit operators can call these methods.
Usage
var person = new Person { Name = "Bob" };
Result invalidResult = Result.Invalid();
Result<Person> result = invalidResult.ToResult(person);
Methods to be added in the
Result
class to perform the conversion fromResult
to:These methods can go in a file named
Result.Conversions.cs
. Note: Implicit operators can call these methods.Usage
PD: These methods have been added.