T4Immutable icon indicating copy to clipboard operation
T4Immutable copied to clipboard

Exclude some properties from the `With` method parameter list

Open bboyle1234 opened this issue 5 years ago • 0 comments

In the case of the class, I'd like the generated With method to create a new object updating Price but not capable of updating 'Id'. Can we decorate the 'Id' property to prevent it being included in the With method parameter list?

[ImmutableClass]
class StockStatus { 
  [SomeExcludeAttribute]
  public string Id { get; } // Wish to exclude this from the With method
  public decimal Price { get; }
}

bboyle1234 avatar Sep 11 '19 02:09 bboyle1234