Click here to Skip to main content
16,018,529 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeView does not show selected node! Pin
Mark F.19-Aug-07 7:28
Mark F.19-Aug-07 7:28 
GeneralRe: TreeView does not show selected node! Pin
Mark Churchill19-Aug-07 15:03
Mark Churchill19-Aug-07 15:03 
GeneralRe: TreeView does not show selected node! Pin
Mark F.20-Aug-07 3:45
Mark F.20-Aug-07 3:45 
QuestionC # Constructor question Pin
radshaykho16-Aug-07 13:15
radshaykho16-Aug-07 13:15 
AnswerRe: C # Constructor question Pin
Colin Angus Mackay16-Aug-07 13:47
Colin Angus Mackay16-Aug-07 13:47 
GeneralRe: C # Constructor question Pin
Paul Conrad16-Aug-07 15:39
professionalPaul Conrad16-Aug-07 15:39 
AnswerRe: C # Constructor question Pin
Luc Pattyn16-Aug-07 13:50
sitebuilderLuc Pattyn16-Aug-07 13:50 
AnswerRe: C # Constructor question Pin
Scott Dorman16-Aug-07 13:52
professionalScott Dorman16-Aug-07 13:52 
First, you should wrap your code sections in <pre> tags to make them easier to read. Second there was no section highlighted in yellow so everything that follows is based on guessing what you were asking.

C#
public abstract class ArgumentParser
{
   private String[] switchChars; // For example: "/", "-"
 
   private String[] switchSymbols; // Switch character(s)
 
   private Boolean caseSensitiveSwitches; // Are switches case-sensitive?
 
   // Domain of results when processing a command-line argument switch
   protected enum SwitchStatus { NoError, Error, ShowUsage };
 
   // Constructor that defaults to case-insensitive switches and 
   // defaults to "/" and "-" as the only valid switch characters
   protected ArgumentParser(String[] switchSymbols) : this(switchSymbols, false, new string[] { "/", "-" })
   {
   }
 
   // Constructor that defaults to "/" and "-" as the only valid switch characters
   protected ArgumentParser(String[] switchSymbols, Boolean caseSensitiveSwitches) 
      : this(switchSymbols, caseSensitiveSwitches, new string[] { "/", "-" })
   {
   }
 
   // Constructor with no defaults
   protected ArgumentParser(String[] switchSymbols, Boolean caseSensitiveSwitches, String[] switchChars)
   {
   this.switchSymbols = switchSymbols;
   this.caseSensitiveSwitches = caseSensitiveSwitches;
   this.switchChars = switchChars;
   }
}
Based on the code presented here, the third constructor (protected ArgumentParser(String[] switchSymbols, Boolean caseSensitiveSwitches, String[] switchChars)) is the one that actually does the work. The other two constructors are overloading the object constructor and providing two additional "short-hand" ways of declaring an instance of the ArgumentParser class that require fewer parameters. The this calls after the function declaration tell the runtime to call that version of the constructor before running any code in the requested constructor. (In this case, there isn't any additional code being run.)

The sequence that happens would be this:


  1. You call the ArgumentParser(String[] switchSymbols) constructor, which
  2. calls the ArgumentParser(String[] switchSymbols, Boolean caseSensitiveSwitches) constructor, passing in switchSymbols (from your call), false, and the string array { "/", "-" } as the parameters.
  3. This constructor runs and returns control back to the constructor you called, which
  4. runs any code contained in it's body (in this case, there isn't any.)
There really isn't a way to make this any simpler other than to remove the overloads and force everyone to call the full constructor; but that isn't really simplifying it.

-----------------------------
In just two days, tomorrow will be yesterday.

http://geekswithblogs.net/sdorman

Questionbyte[] file to PDF and then send in an email as atachment Pin
mvadibb16-Aug-07 12:12
mvadibb16-Aug-07 12:12 
AnswerRe: byte[] file to PDF and then send in an email as atachment Pin
Guffa16-Aug-07 14:48
Guffa16-Aug-07 14:48 
AnswerRe: byte[] file to PDF and then send in an email as atachment Pin
User 167325216-Aug-07 14:49
User 167325216-Aug-07 14:49 
GeneralRe: byte[] file to PDF and then send in an email as atachment Pin
mvadibb17-Aug-07 5:37
mvadibb17-Aug-07 5:37 
Questionc# - handling events for forms Pin
jon-8016-Aug-07 11:16
professionaljon-8016-Aug-07 11:16 
AnswerRe: c# - handling events for forms Pin
Luc Pattyn16-Aug-07 11:18
sitebuilderLuc Pattyn16-Aug-07 11:18 
GeneralRe: c# - handling events for forms Pin
jon-8016-Aug-07 11:34
professionaljon-8016-Aug-07 11:34 
GeneralRe: c# - handling events for forms Pin
Luc Pattyn16-Aug-07 11:50
sitebuilderLuc Pattyn16-Aug-07 11:50 
AnswerRe: c# - handling events for forms Pin
Christian Graus16-Aug-07 11:41
protectorChristian Graus16-Aug-07 11:41 
Questioncreating a webcam driver Pin
moroman16-Aug-07 10:59
moroman16-Aug-07 10:59 
AnswerRe: creating a webcam driver Pin
Luc Pattyn16-Aug-07 11:22
sitebuilderLuc Pattyn16-Aug-07 11:22 
GeneralRe: creating a webcam driver Pin
moroman18-Aug-07 3:42
moroman18-Aug-07 3:42 
QuestionCommunications cable connection between two computers Pin
KeithWT16-Aug-07 9:40
KeithWT16-Aug-07 9:40 
AnswerRe: Communications cable connection between two computers Pin
led mike16-Aug-07 9:57
led mike16-Aug-07 9:57 
GeneralRe: Communications cable connection between two computers Pin
KeithWT16-Aug-07 10:18
KeithWT16-Aug-07 10:18 
GeneralRe: Communications cable connection between two computers Pin
pbraun17-Aug-07 6:04
pbraun17-Aug-07 6:04 
QuestionOpen file error does not produce exception Pin
CTaylor8916-Aug-07 9:12
CTaylor8916-Aug-07 9:12 

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.