© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
19 replies
SWEETPONY

✅ What should I do with the attributes?

public class Arguments                                  
{                                                       
    [Component(InputType.DepartmentsTreeSelect)]        
    [ComponentOptions()]                                
    [JsonProperty(PropertyName = "departments_ids")]    
    public HashSet<string>? DepartmentsIDs { get; set; }
}                                                       
public class Arguments                                  
{                                                       
    [Component(InputType.DepartmentsTreeSelect)]        
    [ComponentOptions()]                                
    [JsonProperty(PropertyName = "departments_ids")]    
    public HashSet<string>? DepartmentsIDs { get; set; }
}                                                       

can you give advice on how to do it better? I just can't think of...
here I have a field over which custom attributes are defined
with the
Component
Component
attribute, there are no problems, we just pass a string that indicates which component to draw

but with
ComponentOptions
ComponentOptions
, everything is more complicated, because the options are a separate class and I would like the user to fill it in, but since we cannot pass it to the attribute class, then I do not know what to do

And this is possible class for
ComponentOptions
ComponentOptions
but I can't use it in attribute
public class ExtendedProperties
{
    /// <summary>
    /// UI component type
    /// </summary>
    [JsonProperty(PropertyName = "inputType")]
    public InputType InputType { get; set; }
    
    /// <summary>
    /// defines order
    /// </summary>
    [JsonProperty(PropertyName = "order")]
    public int Order { get; set; }
    
    /// <summary>
    /// defines multiple selection for UI component
    /// </summary>
    [JsonProperty(PropertyName = "multiple")]
    public bool Multiple { get; set; }
    
    /// <summary>
    /// defines options
    /// </summary>
    [JsonProperty(PropertyName = "options")]
    public Options? Options { get; set; }
    
    /// <summary>
    /// defines component properties
    /// </summary>
    [JsonProperty(PropertyName = "componentProps")]
    public ComponentProperties? ComponentProperties { get; set; }
}
public class ExtendedProperties
{
    /// <summary>
    /// UI component type
    /// </summary>
    [JsonProperty(PropertyName = "inputType")]
    public InputType InputType { get; set; }
    
    /// <summary>
    /// defines order
    /// </summary>
    [JsonProperty(PropertyName = "order")]
    public int Order { get; set; }
    
    /// <summary>
    /// defines multiple selection for UI component
    /// </summary>
    [JsonProperty(PropertyName = "multiple")]
    public bool Multiple { get; set; }
    
    /// <summary>
    /// defines options
    /// </summary>
    [JsonProperty(PropertyName = "options")]
    public Options? Options { get; set; }
    
    /// <summary>
    /// defines component properties
    /// </summary>
    [JsonProperty(PropertyName = "componentProps")]
    public ComponentProperties? ComponentProperties { get; set; }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ what should i do?
C#CC# / help
3y ago
❔ what should I do with this error?
C#CC# / help
3y ago
What should I do next?
C#CC# / help
16mo ago
✅ What should I do now?
C#CC# / help
4y ago