© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
27 replies
Kai

❔ Is there a way to make this neater?

    public void AddTags(string tag)
    {
        Tags?.Add(tag);
        Tags = Tags;
    }

    public void RemoveTag(string tag)
    {
        Tags?.Remove(tag);
        Tags = Tags;
    }
    
    private HashSet<String>? Tags { get; set; }
    public void AddTags(string tag)
    {
        Tags?.Add(tag);
        Tags = Tags;
    }

    public void RemoveTag(string tag)
    {
        Tags?.Remove(tag);
        Tags = Tags;
    }
    
    private HashSet<String>? Tags { get; set; }
I feel like I can do it with {get; set;} but idk how
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

is there is a way to make this faster
C#CC# / help
3y ago
❔ Is there a way to make this more cleaner?
C#CC# / help
3y ago
Is there a way to make this a shorter phrase.
C#CC# / help
14mo ago
What could I do to make this neater?
C#CC# / help
2y ago