Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Creating a New Exception Type
|
403
}
public RemoteComponentException(string message,
Exception innerException)
: base(message, innerException)
{
}
// Exception ctors that accept the new ServerName parameter
public RemoteComponentException(string message,
string serverName) : base(message)
{
this.serverName = serverName;
}
public RemoteComponentException(string message,
Exception innerException, string serverName)
: base(message, innerException)
{
this.serverName = serverName;
}
// Serialization ctor
public RemoteComponentException(SerializationInfo exceptionInfo,
StreamingContext exceptionContext)
: base(exceptionInfo, exceptionContext)
{
this.serverName = exceptionInfo.GetString("ServerName");
}
// Read-only property
public string ServerName
{
get{return (serverName.Trim( ));}
}
public override string Message
{
get
{
if (this.ServerName.Length == 0)
return (base.Message + Environment.NewLine +
"An unnamed server has encountered an error.");
else
return (base.Message + Environment.NewLine +
"The server " + this.ServerName +
" has encountered an error.");
}
}
// Overridden methods
// ToString method
Example 7-4. RemoteComponentException class (continued)
This is the Title of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata