Search code examples
c#constructorentity-framework-6asp.net-identity

Can anyone explain this class constructor with no code body?


More of a why than a how, but how is this possible as I am under the impression all constructors require a code block - even if there's nothing in it?

The following code is taken directly from the class definition for

AspNet.Identity.EntityFramework.IdentityUser

The constructors for the IdentityUser class do not have a code block in the definition? Can anybody explain?

public class IdentityUser : IdentityUser<string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>, IUser, IUser<string>
{
    //
    // Summary:
    //     Constructor which creates a new Guid for the Id
    public IdentityUser();

    //
    // Summary:
    //     Constructor that takes a userName
    public IdentityUser(string userName);
}

Solution

  • This is fake code generated by Visual Studio's Go To Definition service, from a assembly metadata.

    It isn't real code and won't actually compile.

    You can see this in a comment on top of the "file".