Static Class:
Is a class whose members
must be accessed without an instance of the class.
In other words, the members
of a static class must be accessed directly from (using the name of) the class,
using the period operator
Is a class whose members
must be created as static.
In other words, you cannot add a non-static member
to a static class: all members, except for constants, must be static
Partial Class
It is possible to split the definition of a
class or a struct, or an interface over two or more source files. Each source
file contains a section of the class definition, and all parts are combined
when the application is compiled.
When working on large projects, spreading a
class over separate files allows multiple programmers to work on it
simultaneously.
When working with automatically generated
source, code can be added to the class without having to recreate the source
file. Visual Studio uses this approach when creating Windows Forms, Web Service
wrapper code, and so on. You can create code that uses these classes without
having to edit the file created by Visual Studio.
Sample Program:
class Program
{
static void Main()
{
A.A1();
A.A2();
}
}
Contents of file A1.cs: C#
using System;
partial class A
{
public static void A1()
{
Console.WriteLine("A1");
}
}
Contents of file A2.cs: C#
using System;
partial class A
{
public static void A2()
{
Console.WriteLine("A2");
}
}
Output
A1
A2