You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add public properties to the various attributes to capture their constructor arguments?
My use case is that, on app initialization, I generate a list of column names from properties on my row model, and having easy access to the constructor values would be tremendously helpful instead of having to use reflection to look at the constructor arguments. Similarly, I'd like to have easy access to column ordering info.
An example would be:
/// <summary>/// Instructs the SpreadCheetah source generator about what header name to use for a column./// The source generator creates columns from properties, and using the attribute on a property will set the header name for the resulting column./// Header names are written to a worksheet with <see cref="Spreadsheet.AddHeaderRowAsync"/>./// </summary>[AttributeUsage(AttributeTargets.Property, AllowMultiple =false)]publicsealedclassColumnHeaderAttribute:Attribute{/// <summary>/// Returns the name from the first constructor./// </summary>publicstring?Name{get;}/// <summary>/// Use the value of <c>name</c> as the header name for the column./// </summary>publicColumnHeaderAttribute(stringname){Name=name;}/// <summary>/// Returns the type from the second constructor./// </summary>publicType?Type{get;}/// <summary>/// Returns the propertyName from the second constructor./// </summary>publicstring?PropertyName{get;}/// <summary>/// Get the header name from a property. The property must:/// <list type="bullet">/// <item><description>Be a <see langword="static"/> property.</description></item>/// <item><description>Have a public getter.</description></item>/// <item><description>Have a return type of <see langword="string"/> (or <see langword="string?"/>).</description></item>/// </list>/// </summary>publicColumnHeaderAttribute(Typetype,stringpropertyName){Type=type;PropertyName=propertyName;}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Would it be possible to add public properties to the various attributes to capture their constructor arguments?
My use case is that, on app initialization, I generate a list of column names from properties on my row model, and having easy access to the constructor values would be tremendously helpful instead of having to use reflection to look at the constructor arguments. Similarly, I'd like to have easy access to column ordering info.
An example would be:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions