mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[csharp/eng] Partial Classes example
This commit is contained in:
parent
46c37fd745
commit
d65e738fc3
@ -911,6 +911,35 @@ on a new line! ""Wow!"", the masses cried";
|
||||
|
||||
public DbSet<Bicycle> Bikes { get; set; }
|
||||
}
|
||||
|
||||
// Classes can be split across multiple .cs files
|
||||
// A1.cs
|
||||
public partial class A
|
||||
{
|
||||
public static void A1()
|
||||
{
|
||||
Console.WriteLine("Method A1 in class A");
|
||||
}
|
||||
}
|
||||
|
||||
// A2.cs
|
||||
public partial class A
|
||||
{
|
||||
public static void A2()
|
||||
{
|
||||
Console.WriteLine("Method A2 in class A");
|
||||
}
|
||||
}
|
||||
|
||||
// Program using the partial class "A"
|
||||
public class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
A.A1();
|
||||
A.A2();
|
||||
}
|
||||
}
|
||||
} // End Namespace
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user