We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated C# calls the default constructor but it doesn't know what the constructor does.
Is it feasible (!!) for Object Dumper to call the constructor to find out the initial state, and make the right calls for desired state?
Let's say the dumped object has property string A, and the value is null
string A
null
A = "";
A = null;
The text was updated successfully, but these errors were encountered:
I don‘t understand what you mean. ObjectDumper just traverses properties of an already constructed object and dumps content as c# initializer code.
If you can provide some sample code (objects to be dumped) and a simple unit test then I can look into it.
Sorry, something went wrong.
Thanks for your reply. Yes I know. And this feature is unreasonable to ask. (btw - Thanks for creating this project 😄)
Here was my case, approximately
class A { string Prop1 {get; set;} = ""; string Prop2 {get; set;} } var x = new A { Prop1 = null };
I think Object Dumper would dump like this, depending on configuration:
// Incorrect. // Prop1 will be "" var x = new A(); // Correct, but not minimal. var x = new A() { Prop1 = null, Prop2 = null }
Some perfect-world Object Dumper could dump it as
// Understands what the constructor does and overrides it var x = new A { Prop1 = null };
No branches or pull requests
Generated C# calls the default constructor but it doesn't know what the constructor does.
Is it feasible (!!) for Object Dumper to call the constructor to find out the initial state, and make the right calls for desired state?
Example
Let's say the dumped object has property
string A
, and the value isnull
A = "";
A = null;
The text was updated successfully, but these errors were encountered: