Wednesday, June 14, 2017

my data wrapper of T

I'm seeing sort of thing more and more. Instead of just handing an object back from a C# service call or repository call or whatever, one hands back the object, whatever it may be, in a predictable wrapper.

namespace Whatever
{
   public class ImportantStuffWrapper<T>
   {
      public T ImportantStuff { get; set; }
      public bool IsErroneous { get; set; } = false;
      public string ErrorMessage { get; set; }
      public double PriceOfTeaInChina { get; set; }
   }
}

 
 

ImportantStuffWrapper<Ostrich> wraps an Ostrich in this example.

No comments:

Post a Comment