Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
AnswerRe: EventLog Crap Pin
J4amieC14-Nov-08 4:59
J4amieC14-Nov-08 4:59 
AnswerRe: EventLog Crap Pin
Wendelius14-Nov-08 7:49
mentorWendelius14-Nov-08 7:49 
QuestionDesktop App or Access 2003? Pin
hellbentuk14-Nov-08 4:44
hellbentuk14-Nov-08 4:44 
AnswerRe: Desktop App or Access 2003? Pin
mark_w_14-Nov-08 5:11
mark_w_14-Nov-08 5:11 
AnswerRe: Desktop App or Access 2003? Pin
Wendelius14-Nov-08 7:56
mentorWendelius14-Nov-08 7:56 
AnswerRe: Desktop App or Access 2003? Pin
Paul Conrad14-Nov-08 8:48
professionalPaul Conrad14-Nov-08 8:48 
GeneralRe: Desktop App or Access 2003? Pin
hellbentuk15-Nov-08 1:41
hellbentuk15-Nov-08 1:41 
QuestionException Constructor Pin
George_George14-Nov-08 2:17
George_George14-Nov-08 2:17 
Hello everyone,


For the exception constructor,

Exception Constructor (SerializationInfo, StreamingContext)

http://msdn.microsoft.com/en-us/library/tz6bzkbf.aspx

I have two questions,

1. I saw some code defines it as public and some other code defines it as protected. What are the different purposes of different definitions?

2. I saw some code which defines a new exception type derives from System.Exception, and implements this contructor, but the implementation code is just call the base class constructor, and at the same time, the class is marked with Serializable tag. Like this.

I think such type of implementation is useless since the implementation of constructor is empty (just call base class contructor and the class is already marked with Serializable tag), so it is system default behavior and it should be ok to just mark it with Serializable tag to achieve the same effect.

Any comments?

[Serializable]
public class MyExceptionClass : Exception
{
    public MyExceptionClass (string errorMessage)
    {

    }

    public MyExceptionClass (SerializationInfo info, StreamingContext context) : base (nfo, context)
	{

	}
}



thanks in advance,
George
AnswerRe: Exception Constructor Pin
J4amieC14-Nov-08 2:23
J4amieC14-Nov-08 2:23 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 2:05
George_George16-Nov-08 2:05 
AnswerRe: Exception Constructor Pin
Le centriste14-Nov-08 5:44
Le centriste14-Nov-08 5:44 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 2:07
George_George16-Nov-08 2:07 
GeneralRe: Exception Constructor Pin
Le centriste16-Nov-08 2:33
Le centriste16-Nov-08 2:33 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 2:47
George_George16-Nov-08 2:47 
GeneralRe: Exception Constructor Pin
Le centriste16-Nov-08 2:54
Le centriste16-Nov-08 2:54 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 2:56
George_George16-Nov-08 2:56 
GeneralRe: Exception Constructor Pin
N a v a n e e t h17-Nov-08 15:06
N a v a n e e t h17-Nov-08 15:06 
GeneralRe: Exception Constructor Pin
George_George18-Nov-08 2:21
George_George18-Nov-08 2:21 
AnswerRe: Exception Constructor Pin
N a v a n e e t h14-Nov-08 17:36
N a v a n e e t h14-Nov-08 17:36 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 2:08
George_George16-Nov-08 2:08 
GeneralRe: Exception Constructor Pin
N a v a n e e t h16-Nov-08 3:35
N a v a n e e t h16-Nov-08 3:35 
GeneralRe: Exception Constructor Pin
George_George16-Nov-08 3:40
George_George16-Nov-08 3:40 
QuestionMediaElement Recorder Pin
mabbas_8614-Nov-08 2:09
mabbas_8614-Nov-08 2:09 
AnswerRe: MediaElement Recorder Pin
Thomas Stockwell14-Nov-08 2:55
professionalThomas Stockwell14-Nov-08 2:55 
Questionsimple example of asp.net page using control Pin
maifs14-Nov-08 1:58
maifs14-Nov-08 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.