C # calls to methods in different files or classes in the same project

Source: Internet
Author: User

There are two methods, one is to set the called class to static class statics, so it can be directly point out, and the second is to set the method of the call to public, which must be called in the class to be called first to the entity, new () out, and then point out.

One

public class a{

public void A () {};

}

public class b{

public void B () {

A aa = new A ();

AA.A ();

}

}

Two

Static Class a{

public void A () {};

}

Static Class b{

public void B () {

A.A ();

}

}

On exactly which method, depending on the circumstances, the individual biased to public, you can refer to a blog post mountains "talk about the static in C #" and post-blog comments, are very exciting ah.

C # calls to methods in different files or classes in the same project

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.