C # about: Base () usage, record here for easy access
1.this is the identity of the current resource object, and base is parent-based.
2.base played the role of the soul level-polymorphic
3.base subclasses can access parent class members
4.base calling the parent class method must override the parent class method
5.base sub-class constructor direct access: Base Parent class construction method
6.base is also not available for static methods
Public Abstract class Httpbasedtransport:clienttransportbase { protectedstring transportname) Base (HttpClient, Transportname) { } }
Parent class
Public Abstract classClienttransportbase:iclienttransport {Private ReadOnlyihttpclient _httpclient; Private ReadOnly string_transportname; Private ReadOnlyTransporthelper _transporthelper; Private ReadOnlyTransportaborthandler _aborthandler; Private BOOL_finished =false; PrivateTransportinitializationhandler _initializationhandler; [SuppressMessage ("microsoft.reliability","Ca2000:dispose objects before losing scope", justification ="disposed in the Dispose method.")] protectedClienttransportbase (Ihttpclient httpClient,stringtransportname): This(HttpClient, Transportname,NewTransporthelper (),NewTransportaborthandler (httpClient, Transportname)) { } InternalClienttransportbase (Ihttpclient httpClient,stringTransportname, Transporthelper transporthelper, Transportaborthandler Aborthandler) { if(HttpClient = =NULL) { Throw NewArgumentNullException ("httpClient"); } if(string. Isnullorwhitespace (Transportname)) {Throw NewArgumentNullException ("Transportname"); } Debug.Assert (Transporthelper!=NULL,"Transporthelper is null"); Debug.Assert (Aborthandler!=NULL,"Aborthandler is null"); _httpclient=httpClient; _transportname=Transportname; _transporthelper=Transporthelper; _aborthandler=Aborthandler; } }
(GO) C #: Usage of base (base after colon)