question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I have been through the documentation but cannot find an example of how to do the following:

Given the class:

public class Plane
{
     private readonly double length;
     public double Length { get => length; }
     public int Rows { get; set; }

     public Plane(int rows, double Length)
     {
          Rows = rows;
          length = Length;
     }

     public Plane(double Length)
     {
          length = Length;
     }
}

var p = new Plane(4.33);

How do I serialize this as <Plane Length="4.33" /> ? I explicitly do not want the Rows to get serialized and the Length must be as an attribute.

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Jones-Adamcommented, Dec 7, 2017

Thanks Mike!

1reaction
Mike-E-angelocommented, Jan 3, 2018

Happy New Year. 😃 Closing this issue as the latest code addresses it to the best of our understanding. Please feel free to comment here and/or re-open a new issue if there is something not captured and needs to be addressed. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

readonly keyword - C# Reference
In a field declaration, readonly indicates that assignment to the field can only occur as part of the declaration or in a constructor...
Read more >
What are the benefits to marking a field as `readonly` in C# ...
It's simply a check to ensure that once the object is fully constructed, that field cannot be pointed to a new value. However...
Read more >
HTML input readonly Attribute
The readonly attribute is a boolean attribute. When present, it specifies that an input field is read-only. A read-only input field cannot be...
Read more >
Readonly in C# - GeeksforGeeks
Readonly Fields : In C#, you are allowed to declare a field using readonly modifier. It indicates that the assignment to the fields...
Read more >
Make fields readonly | ReSharper Documentation
Add the 'readonly' keyword to fields that only have read access · Press Ctrl Alt 0F or choose ReSharper | Edit | Cleanup...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found