Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ private async Task<string> DelayAsync()
// Exception Message: canceled
// Task IsCanceled: True
// Task IsFaulted: False

//</Snippet2>


Expand Down Expand Up @@ -116,4 +115,4 @@ private async Task ExcAsync(string info)
//</Snippet4>
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@ in BaseClass(int i)
*/
//</snippet2>

namespace Example1 //for redefinition of Employee
{
//<snippet4>
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;
}
}
//</snippet4>
}

namespace Example2 //for redefinition of Employee
{
//<snippet3>
Expand All @@ -102,14 +121,13 @@ class Employee
private decimal salary = 3000.00m;

// Constructor:
//<snippet4>
public Employee(string name, string alias)
{
// Use this to qualify the fields, name and alias:
this.name = name;
this.alias = alias;
}
//</snippet4>

// Printing method:
public void printEmployee()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,34 @@ void ReadFile(int index)

//<snippet2>
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.
* */

//</snippet2>

//<snippet3>
Expand Down