More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Friday, 3 April 2015 9:44:48 PM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 23/11/2008(UTC)
Posts: 519

In C#, it is possible to split the definition of a class or a struct, an interface or a method over two or more source files. Why? See the situations when splitting a class definition:
1. When working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time.
2. Code generators automatically generates the code they need to emit and do not have to deal with user edits to the file. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. Users are likewise free to annotate the class with new members by having a second partial class. You can create code that uses these classes without having to modify the file created by Visual Studio.

To split a class definition, use the partial keyword modifier

Code:
public partial class Company
{
    public void Input()
    {
    }
}

public partial class Company
{
    public void Output()
    {
    }
}
Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.