0% found this document useful (0 votes)
8 views1 page

C# Generic Response Wrapper Method

This method takes in a boolean value and generic type T, creates a ResponseWrapper object of type T, and sets the Code, Status, and Message properties of the ResponseWrapper based on the boolean value. It returns the ResponseWrapper object.

Uploaded by

ashish877
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

C# Generic Response Wrapper Method

This method takes in a boolean value and generic type T, creates a ResponseWrapper object of type T, and sets the Code, Status, and Message properties of the ResponseWrapper based on the boolean value. It returns the ResponseWrapper object.

Uploaded by

ashish877
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

//private static ResponseWrapper<T> GetWrapper<T>(bool?

val, T model) where T : class


//{
// var responseWrapper = new ResponseWrapper<T>();
// if (val != null && model == null)
// {
// [Link] = [Link](val) ?
(int)[Link] : (int)[Link];
// [Link] = [Link](val) ?
[Link] : [Link];
// [Link] = [Link](val) ?
[Link] : [Link];
// }
// else if (val == null && model != null)
// {
// var type = [Link]();
// var modelName = [Link];
// }
// return responseWrapper;
//}

/// <summary>
/// The GetWrapper
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="val">The val<see cref="bool"/></param>
/// <returns>The <see cref="ResponseWrapper{T}"/></returns>
private static ResponseWrapper<T> GetWrapper<T>(bool val) where T : class
{
var responseWrapper = new ResponseWrapper<T>();
[Link] = val ? (int)[Link] :
(int)[Link];
[Link] = val ? [Link] :
[Link];
[Link] = val ? [Link] :
[Link];
return responseWrapper;
}

You might also like