Optional Argument: compile time constant issue

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2012-09-04T14:57:01Z Indexed on 2012/09/04 15:38 UTC
Read the original article Hit count: 299

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET