diegofrata / Generator.Equals

A source code generator for automatically implementing IEquatable<T> using only attributes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler-error with static properties

bastianeicher opened this issue · comments

Classes with static properties, like:

[Equatable]
partial class Sample
{
    public string Property { get; set; }
    
    public static string StaticProperty { get; set; }
}

lead to a compiler error when used with Generator.Equals:

Member 'Sample.StaticProperty' cannot be accessed with an instance reference; qualify it with a type name instead

As a workaround, I can mark static properties with [IgnoreEquality]. However, I think it would be better if Generator.Equals simply ignored them by default.

Fixed in 2.2.2.