From 3d00f7f68d3c5a4a4c87100a643fd1d5b4bbaa4d Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Tue, 13 Nov 2018 20:39:16 -0800 Subject: [PATCH 1/2] port changes --- .../CS/csrefKeywordsAccess.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsAccess/CS/csrefKeywordsAccess.cs b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsAccess/CS/csrefKeywordsAccess.cs index 17eae4007cd..3eb73210724 100644 --- a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsAccess/CS/csrefKeywordsAccess.cs +++ b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsAccess/CS/csrefKeywordsAccess.cs @@ -92,6 +92,25 @@ in BaseClass(int i) */ // + namespace Example1 //for redefinition of Employee + { + // + public class Employee + { + private string alias; + private string name; + + public Employee(string name, string alias) + { + // Use this to qualify the members of the class + // instead of the constructor parameters. + this.name = name; + this.alias = alias; + } + } + // + } + namespace Example2 //for redefinition of Employee { // @@ -102,14 +121,13 @@ class Employee private decimal salary = 3000.00m; // Constructor: - // public Employee(string name, string alias) { // Use this to qualify the fields, name and alias: this.name = name; this.alias = alias; } - // + // Printing method: public void printEmployee() { From 3e8f06785bd42c3019468989d7309f68f5450c59 Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Tue, 13 Nov 2018 21:09:33 -0800 Subject: [PATCH 2/2] formatting fixes --- .../csasyncexceptions/cs/class1.cs | 3 +- .../CS/csrefKeywordsExceptions.cs | 34 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/snippets/csharp/VS_Snippets_VBCSharp/csasyncexceptions/cs/class1.cs b/snippets/csharp/VS_Snippets_VBCSharp/csasyncexceptions/cs/class1.cs index 6c4ac82ea58..9b5fb690fd7 100644 --- a/snippets/csharp/VS_Snippets_VBCSharp/csasyncexceptions/cs/class1.cs +++ b/snippets/csharp/VS_Snippets_VBCSharp/csasyncexceptions/cs/class1.cs @@ -70,7 +70,6 @@ private async Task DelayAsync() // Exception Message: canceled // Task IsCanceled: True // Task IsFaulted: False - // @@ -116,4 +115,4 @@ private async Task ExcAsync(string info) // } -} +} \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsExceptions/CS/csrefKeywordsExceptions.cs b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsExceptions/CS/csrefKeywordsExceptions.cs index 0f11f63ea15..a905b889893 100644 --- a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsExceptions/CS/csrefKeywordsExceptions.cs +++ b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsExceptions/CS/csrefKeywordsExceptions.cs @@ -39,36 +39,34 @@ void ReadFile(int index) // class TryFinallyTest -{ - static void ProcessString(string s) { - if (s == null) + static void ProcessString(string s) { - throw new ArgumentNullException(); + if (s == null) + { + throw new ArgumentNullException(); + } } - } - static void Main() - { - string s = null; // For demonstration purposes. - - try - { - ProcessString(s); - } - - catch (Exception e) + static void Main() { - Console.WriteLine("{0} Exception caught.", e); + string s = null; // For demonstration purposes. + + try + { + ProcessString(s); + } + catch (Exception e) + { + Console.WriteLine("{0} Exception caught.", e); + } } } -} /* Output: System.ArgumentNullException: Value cannot be null. at TryFinallyTest.Main() Exception caught. * */ - // //