Replies: 1 comment 2 replies
-
This might help you out: https://stackoverflow.com/a/75958935 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In a blazor server app we have grids and the columns are bound to a field:
<DxGridDataColumn FieldName="Source.DocNr")" />
I don't like this code above as if the (view)model changes (e.g. rename of property) the strings are not renamed.
That is why I try to use
nameof
where possible, like this:<DxGridDataColumn FieldName="@($"{nameof(HistoryGridItem.Source)}.{nameof(HistoryGridItem.Source.DocNr)}")" />
However this feels to clumsy to write it like this.
Let's say a field is bound to
Foo.Bar.Car
then I have really something like this:<DxGridDataColumn FieldName="@($"{nameof(HistoryGridItem.Foo)}.{nameof(HistoryGridItem.Foo.Bar)}.{nameof(HistoryGridItem.Foo.Bar.Car)}")" />
Is there another 'not so clumsy' way to write this (and having the advantage of nameof in case of model changes/renames etc... ?
Beta Was this translation helpful? Give feedback.
All reactions