Why is this working:
public int DoesEmailAddressExistsExcludingEmailAddressID(
string emailAddress,
string invitationCode,
int emailAddressID = 0,
int For = (int) Enums.FOR.AC)
whereas this doesn’t
public int DoesEmailAddressExistsExcludingEmailAddressID(
string emailAddress,
string invitationCode,
int emailAddressID = 0,
int For = Enums.FOR.AC.GetHashCode())
where AC is enum. Can enums’s hashcode change at runtime?
GetHashCodeis a method. The return value of a method is not a compile time constant as code needs to be executed to determine the return value.It doesn’t matter whether or not the method returns always the same.