Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Prevent EnumType() accessor vs EnumType.NULL_VALUE name clash #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaelszymczak
Copy link
Contributor

BUGFIX: Prevent EnumType() accessor vs EnumType.NULL_VALUE name clash when sinceVersion used.

C# uses an upper case notation for both method names and types. When the same name is used for the accessor and the type, it causes the following name clash.

public SomeEnum SomeEnum()
    {
        if (_actingVersion < 1) return SomeEnum.NULL_VALUE;

        return (SomeEnum)unchecked((sbyte)_buffer.GetByte(_offset + 29));
    }

This is a compilation error.

The solution is to use a fully qualified name in this case.

public SomeEnum SomeEnum()
    {
        if (_actingVersion < 1) return Com.Example.SomeEnum.NULL_VALUE;

        return (SomeEnum)unchecked((sbyte)_buffer.GetByte(_offset + 29));
    }

This fixed the problem.

… when sinceVersion used.

C# uses an upper case notation for both method names and types. When the same name is used for the accessor and the type, it causes the following  name clash.

```
public SomeEnum SomeEnum()
    {
        if (_actingVersion < 1) return SomeEnum.NULL_VALUE;

        return (SomeEnum)unchecked((sbyte)_buffer.GetByte(_offset + 29));
    }
```

This is a compilation error.

The solution is to use a fully qualified name in this case.

```
public SomeEnum SomeEnum()
    {
        if (_actingVersion < 1) return Com.Example.SomeEnum.NULL_VALUE;

        return (SomeEnum)unchecked((sbyte)_buffer.GetByte(_offset + 29));
    }
```

This fixed the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant