Writing a custom exception and the "meaning" of the code
-
Hi. I'm a total beginner in C# (and PC programming), but I'm starting to get the logic to work allright so I've got some hours in front of the computer. A couple of days ago I wanted to throw my own exception and I used the intellisense codesnippet to generate a new custom exception class. This works great and I have no problems using it, however I do not fully understand WHAT the lines of code actually do (how they work and what they are for). Since I got it working, I guess I really don't have to know what it does (since it is in fact working), however to expand my knowledge (and possible learn some tricks for the future) I would like to know what each line of the auto-generated code actually does, and what it is for. Would anyone please do a quick explain of the code? I have pasted the auto-generated code here:
\[global::System.Serializable\] public class IndexException : Exception { //Autogenerated code public IndexException() { } public IndexException(string message) : base(message) { } //public IndexException(string message, Exception inner) : base(message, inner) { } protected IndexException( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } }
-
Hi. I'm a total beginner in C# (and PC programming), but I'm starting to get the logic to work allright so I've got some hours in front of the computer. A couple of days ago I wanted to throw my own exception and I used the intellisense codesnippet to generate a new custom exception class. This works great and I have no problems using it, however I do not fully understand WHAT the lines of code actually do (how they work and what they are for). Since I got it working, I guess I really don't have to know what it does (since it is in fact working), however to expand my knowledge (and possible learn some tricks for the future) I would like to know what each line of the auto-generated code actually does, and what it is for. Would anyone please do a quick explain of the code? I have pasted the auto-generated code here:
\[global::System.Serializable\] public class IndexException : Exception { //Autogenerated code public IndexException() { } public IndexException(string message) : base(message) { } //public IndexException(string message, Exception inner) : base(message, inner) { } protected IndexException( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } }
-
Thanks a lot!! I've already seen the msdn article (which for me who don't know very much about PC programming yet did not help my understanding very much). However, the other article looks great!! Thanks again!