From d65e738fc339c7b1481dc88cb1c39d1ec8777b6d Mon Sep 17 00:00:00 2001 From: Andrew Backes Date: Thu, 15 Oct 2015 23:26:57 -0500 Subject: [csharp/eng] Partial Classes example --- csharp.html.markdown | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/csharp.html.markdown b/csharp.html.markdown index 7aca2c6f..d62dadec 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -911,6 +911,35 @@ on a new line! ""Wow!"", the masses cried"; public DbSet 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 ``` -- cgit v1.2.3