Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

Changing Collection properties to conform to CA1819 and CA2227 #32

@Ruhrpottpatriot

Description

@Ruhrpottpatriot

As of now our collection properties violate the CA1819 and CA2227 rules for managed code.
We should change the collection properties to conform to those rules, as seem exemplary below. This is the recommended way to do things and should not affect performance in any significant way.

public ICollection<CombatAttribute> Attributes { get; private set; } = new Collection<CombatAttribute>(0);

public void SetCollection(IEnumerable<CombatAttribute> attributes)
{
    if(attributes == null)
    {
        throw new ArgumentNullException();
    }
    this.Attributes = attributes;
}

Since the C# compiler generates instance methods in the MSIL for properties, we can remove the setter and replace it with a method which just assigns the collection. This shold not degrade performance

References:
#30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions