How does the method Initialize(); work in the membership.cs class of asp.net?

83 views Asked by At

I'm attempting to understand the membership class and how it works in asp.net, however when looking at the Membership.cs file, I see the following code,

public static MembershipProvider Provider {
        get { 
            Initialize();
            if (s_Provider == null) {
                throw new InvalidOperationException(SR.GetString(SR.Def_membership_provider_not_found));
            } 
            return s_Provider;
        } 
    } 

I don't see a local method, and the class doesn't seem to inherit from any source that would provide code for it. How is it that the Initialize() method is able to give value to the s_Provider variable and where does its code live?

1

There are 1 answers

0
Servy On BEST ANSWER

The class is a partial class. There is another file in the assembly that has the same full name, and is also marked as partial, and that contains a definition for that method.

You can use the Visual Studio "Go to Definition" feature in the context menu of Initialize to open up that file and navigate to the definition of that method.