Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

When I create a page in Test_Page.aspx, Test_Page.aspx.cs is created.
- Is it possible to create another class file for same Test_Page. Because my class file has many functions and I want to split it.
- If Yes, Kindly guide me for the same (How to use and access it).
- If No, Kindly forgive me, I am new to .Net and suggest if any alternate.

Regards,
AP
Posted

1 solution

Yes it is possible, try using partial keyword.
There is a concept of partial type definitions for classes, structs, and interfaces, as a means to break types in a program into multiple pieces to be stored in different source files for easier maintenance and development. This approach is particularly useful when the need arises to use nested types or provide interface implementation.

Have a look at below articles:
Introducing C# 2.0 Partial Types[^]
C# Language Features, From C# 2.0 to 4.0[^]
http://msdn.microsoft.com/en-us/library/wa80x488(v=vs.80).aspx[^]
 
Share this answer
 
Comments
Prasad_Kulkarni 22-Jun-12 0:10am    
Good answer +5!
Vani Kulkarni 22-Jun-12 0:24am    
Thanks Prasad!
Raghuveer Kasyap 22-Jun-12 1:22am    
Solution1 is absolutely correct
Sandeep Mewara 22-Jun-12 1:48am    
Good answer! 5!
:)
Vani Kulkarni 22-Jun-12 1:50am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900