Skip to content

Example in README seems to be broken #82

@ratijas

Description

@ratijas

README suggests the following:

[LobbyCompatibility(CompatibilityLevel = CompatibilityLevel.Everyone, VersionStrictness = VersionStrictness.Minor)]

But is does not compile:

There is no argument given that corresponds to the required parameter 'compatibilityLevel' of 'LobbyCompatibilityAttribute.LobbyCompatibilityAttribute(CompatibilityLevel, VersionStrictness)'CS7036

Because

  1. the signature of Attribute's constructor has parameters whose names start with lowercase:

        public LobbyCompatibilityAttribute(CompatibilityLevel compatibilityLevel, VersionStrictness versionStrictness)

    and...

  2. the correct syntax is to use double-colon for named parameters or not using names at all.

        [LobbyCompatibility(compatibilityLevel: CompatibilityLevel.Everyone, versionStrictness: VersionStrictness.Minor)]
        [LobbyCompatibility(CompatibilityLevel.Everyone, VersionStrictness.Minor)]

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#2223-positional-and-named-parameters

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