C # related

Source: Internet
Author: User

I. NET and winformCodeGet webconfig content

Webconfig:

 
<Deleetask>
<Add key ="Strconn"Value ="Server = 10.1.0.7; database = dB; uid = sa; Password ="/>
</Appsettings>

Get in code:

 
UsingSystem. configuration;
Private Static StringConnectionstring = configurationsettings. etettings ["Strconn"]. Tostring ();

However, the configurationsettings mentioned above are outdated and need to be replaced by configurationmanager. However, the configurationmanager's

Only referencesSystem. configuration. dllCan be found

 
Private Static StringConnectionstring = system. configuration. configurationmanager. etettings ["Strconn"]. Tostring ();

Net can be obtained, and winform seems to be unable to be obtained. XML can be obtained.Portal

2. "NoSource code"

I encountered an error in modifying others' source code.

Cause: because the old DLL is called, and your path and the location of the original project are not

Solution: you only need to clear the small project and module with the error and generate a new one.

Details:

Right-click solution> Properties> Common Properties> debug source file,

Look at yourProgramHas it been added to the "do not find these source files" box.

Then you can see if your path does not exist. Find the Project block of the source file: Clean Up + generate

Iii. Usage of Base

 Public Temp2 ( Int Fo ): Base () //  Call the constructors without parameters of the parent class.  
{
Console. writeline ( " Child class no paramer " );
}
Public Temp2 ( Int Fo ): Base (FO) // Call the constructor with parameters of the parent class.
{
Console. writeline ( " Child class " );
}
Public Override Void Showinfo () // Reload the showinfo method of the parent class
{
Base . Showinfo (); // Call the showinfo method of the parent class
Console. writeline ( " This child's Method " );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.