I have several summary objects that look like this:
public class ObjectSummary : ISummary { public int Id { get; set;} public string Name { get; set;} ...
With a usage example that looks like this:
public ISummary Summarize() { return new ObjectSummary { Id = _id, Name = _name, ....
And I'm trying to reorganize all instances like this (make them immutable):
public class ObjectSummary : ISummary { public ObjectSummary(int id, string name,..., ) { Id = id; Name = name; } public int Id { get; private set;} public string Name { get; private set;}
How can I reorganize an object that uses the object initializer to make it immutable (also moving the set logic from the object initializer to the constructor)?
source share