locked
Partial classes RRS feed

  • Question

  • User-394508673 posted

    Can some one explain the use of partial classes (in code behind file e.g axpx.cs). why they are partial???

    Monday, May 26, 2008 12:32 AM

Answers

  • User-833084849 posted

    Partial class is a new functionality that is included in Visual Studio .Net 2005 and is supported in ASP.Net 2.0. This new functionality helps you to split a single class into multiple partial classes. These partial classes can be in different individual files.

    http://www.dotnet-guide.com/partialclasses.html 

     

    http://www.aspnetpro.com/newsletterarticle/2007/01/asp200701jk_l/asp200701jk_l.asp 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:09 AM
  • User-334687597 posted

    Partial Classes are the one's whose source definition can span into multiple files . Each individual source file contain's the section of the class file . At compile time all these discrete parts are combined into one . In order to make a class as partial class use " partial " keyword .

    One major reason why we should go for partial classes is that in real time scenario where project magnitude is big , we can mak a class as partial so that multiple people can simultaneoulsy operate on iot and can implement it without botheing what other's are doing .

    eg.

    public partial class A

    {

    public void funB(){ ...........}

    }

     

    public partial class A

    {

    public void funA(){ ...........}

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:18 AM
  • User2144660718 posted

    Visual Basic uses partial-class definitions to separate generated code from user-authored code in separate source files. For example, the Windows Form Designer defines partial classes for controls such as <MSHelp:link tabindex="0" keywords="T:System.Windows.Forms.Form">Form</MSHelp:link>. You should not modify the generated code in these controls.

    - MSDN

    http://en.wikipedia.org/wiki/Partial_class

    http://www.dotnet-guide.com/partialclasses.html 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:19 AM
  • User-78720341 posted

     hello dear

     

    http://www.knowdotnet.com/articles/partialclassforms.html

    http://www.devx.com/dotnet/Article/22603/1954

    http://www.devx.com/dotnet/Article/22603

     

    Go through these document it will help you  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:31 AM
  • User113421904 posted

    Hi,

    For ASP.NET web application, partial keyword is usually seen in the definition of the page class, it is new in ASP.NET 2.0 and later. Here is one example of partial class from one of the Code-Behind file:

    For VB.NET, you can see it like this:

    Partial Class Default
        Inherits System.Web.UI.Page

    End Class 

    This is because ASP.NET generates partial classes for .aspx and code-behind class file.  When the application is build, those parts are combined.

    http://msdn.microsoft.com/en-us/library/wa80x488.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 28, 2008 5:29 AM

All replies

  • User-833084849 posted

    Partial class is a new functionality that is included in Visual Studio .Net 2005 and is supported in ASP.Net 2.0. This new functionality helps you to split a single class into multiple partial classes. These partial classes can be in different individual files.

    http://www.dotnet-guide.com/partialclasses.html 

     

    http://www.aspnetpro.com/newsletterarticle/2007/01/asp200701jk_l/asp200701jk_l.asp 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:09 AM
  • User-334687597 posted

    Partial Classes are the one's whose source definition can span into multiple files . Each individual source file contain's the section of the class file . At compile time all these discrete parts are combined into one . In order to make a class as partial class use " partial " keyword .

    One major reason why we should go for partial classes is that in real time scenario where project magnitude is big , we can mak a class as partial so that multiple people can simultaneoulsy operate on iot and can implement it without botheing what other's are doing .

    eg.

    public partial class A

    {

    public void funB(){ ...........}

    }

     

    public partial class A

    {

    public void funA(){ ...........}

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:18 AM
  • User2144660718 posted

    Visual Basic uses partial-class definitions to separate generated code from user-authored code in separate source files. For example, the Windows Form Designer defines partial classes for controls such as <MSHelp:link tabindex="0" keywords="T:System.Windows.Forms.Form">Form</MSHelp:link>. You should not modify the generated code in these controls.

    - MSDN

    http://en.wikipedia.org/wiki/Partial_class

    http://www.dotnet-guide.com/partialclasses.html 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:19 AM
  • User-78720341 posted

     hello dear

     

    http://www.knowdotnet.com/articles/partialclassforms.html

    http://www.devx.com/dotnet/Article/22603/1954

    http://www.devx.com/dotnet/Article/22603

     

    Go through these document it will help you  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 26, 2008 1:31 AM
  • User113421904 posted

    Hi,

    For ASP.NET web application, partial keyword is usually seen in the definition of the page class, it is new in ASP.NET 2.0 and later. Here is one example of partial class from one of the Code-Behind file:

    For VB.NET, you can see it like this:

    Partial Class Default
        Inherits System.Web.UI.Page

    End Class 

    This is because ASP.NET generates partial classes for .aspx and code-behind class file.  When the application is build, those parts are combined.

    http://msdn.microsoft.com/en-us/library/wa80x488.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 28, 2008 5:29 AM