S
Shawn Anderson
I ran into something that I consider a little strange this weekend and I was
wondering if any of the Gurus out there could explain it to me. Here is a
sample piece of code that will not compile because of line 11.
1: using System;
2:
3: namespace eyecatcher.System
4: {
5: class CommandLineParser
6: {
7: private string m_sCmdLine;
8:
9: public CommandLineParser()
10: {
11: Parse(System.Environment.CommandLine); <-- Error occurs
here.
12: }
13:
14: public CommandLineParser(string sCmd)
15: {
16: Parse(sCmd);
17: }
18:
19: private void Parse(string sCmd)
20: {
21: m_sCmdLine = sCmd;
22: }
23: }
24: }
However if I change line 11 to look like this:
Parse(Environment.CommandLine);
Everything works.
I spent a large portion of this weekend looking through the language specs
and I could find no reason as to why my code failed. As a matter of fact,
it seemed more likely (according to the documentation) that my fix should
actually be causing an error and my original code should be correct.
Anyways, if anyone has any helpful insights I would greatly appreciate it.
Thanks
Shawn Anderson
wondering if any of the Gurus out there could explain it to me. Here is a
sample piece of code that will not compile because of line 11.
1: using System;
2:
3: namespace eyecatcher.System
4: {
5: class CommandLineParser
6: {
7: private string m_sCmdLine;
8:
9: public CommandLineParser()
10: {
11: Parse(System.Environment.CommandLine); <-- Error occurs
here.
12: }
13:
14: public CommandLineParser(string sCmd)
15: {
16: Parse(sCmd);
17: }
18:
19: private void Parse(string sCmd)
20: {
21: m_sCmdLine = sCmd;
22: }
23: }
24: }
However if I change line 11 to look like this:
Parse(Environment.CommandLine);
Everything works.
I spent a large portion of this weekend looking through the language specs
and I could find no reason as to why my code failed. As a matter of fact,
it seemed more likely (according to the documentation) that my fix should
actually be causing an error and my original code should be correct.
Anyways, if anyone has any helpful insights I would greatly appreciate it.
Thanks
Shawn Anderson