Click here to Skip to main content
15,913,836 members
Home / Discussions / C#
   

C#

 
GeneralRe: What is the name of this control Pin
AspDotNetDev1-Apr-10 15:21
protectorAspDotNetDev1-Apr-10 15:21 
AnswerRe: What is the name of this control Pin
kevinnicol1-Apr-10 9:55
kevinnicol1-Apr-10 9:55 
QuestionLINQ to SQL Pin
Darrall1-Apr-10 7:40
Darrall1-Apr-10 7:40 
AnswerRe: LINQ to SQL Pin
Dan Mos1-Apr-10 8:01
Dan Mos1-Apr-10 8:01 
GeneralRe: LINQ to SQL Pin
Darrall1-Apr-10 8:09
Darrall1-Apr-10 8:09 
GeneralRe: LINQ to SQL Pin
Dan Mos1-Apr-10 11:18
Dan Mos1-Apr-10 11:18 
GeneralRe: LINQ to SQL Pin
Darrall1-Apr-10 11:54
Darrall1-Apr-10 11:54 
QuestionConsole app: Take arguments as verbatim string aka how do I create a verbatim string list? Pin
bbranded1-Apr-10 6:38
bbranded1-Apr-10 6:38 
Hello,

I'm attempting to have a console program take a path as an argument.

I have the following code executing:


static void Main(string[] args)
{
         HandleArgs(args);
}

public static void HandleArgs(string[] args)
{
         foreach (string arg in args)
         {
                  if (arg.Contains("/path:"))
                  {
                           string execpath = arg.Substring(6, arg.Length - 6);
                  }
         }
}



What i'd like to do is to take the string[] args as it is passed to Main() as a verbatim string.

The problem arises when the argument /path: is input as /path:"c:\documents and settings\". The string arg in args is not verbatim, and execpath is then c:\documents and settings\" not c:\documents and settings\ as desired.

Another foreseeable situation is the the /path: argument is /path:""c:\documents and settings\", as I am attempting a condition to determine if the last character is a \


How can I take the string into string[] args passed to Main() as a a verbatim string.


Thanks,

Matt
AnswerRe: Console app: Take arguments as verbatim string aka how do I create a verbatim string list? [modified] Pin
PIEBALDconsult1-Apr-10 6:45
mvePIEBALDconsult1-Apr-10 6:45 
GeneralRe: Console app: Take arguments as verbatim string aka how do I create a verbatim string list? [modified] Pin
bbranded1-Apr-10 7:20
bbranded1-Apr-10 7:20 
GeneralRe: Console app: Take arguments as verbatim string aka how do I create a verbatim string list? Pin
Daniel Grunwald1-Apr-10 7:35
Daniel Grunwald1-Apr-10 7:35 
GeneralRe: Console app: Take arguments as verbatim string aka how do I create a verbatim string list? Pin
bbranded1-Apr-10 7:42
bbranded1-Apr-10 7:42 
AnswerRe: Console app: Take arguments as verbatim string aka how do I create a verbatim string list? Pin
PIEBALDconsult1-Apr-10 13:39
mvePIEBALDconsult1-Apr-10 13:39 
QuestionRe: Calling an event to a class in a different namespace Pin
roman_s1-Apr-10 5:50
roman_s1-Apr-10 5:50 
AnswerRe: Calling an event to a class in a different namespace Pin
Ghydo1-Apr-10 6:20
Ghydo1-Apr-10 6:20 
AnswerRe: Calling an event to a class in a different namespace Pin
Not Active1-Apr-10 6:37
mentorNot Active1-Apr-10 6:37 
QuestionError loading XML data Pin
billy_iii1-Apr-10 3:23
billy_iii1-Apr-10 3:23 
AnswerRe: Error loading XML data Pin
Garry J Evans1-Apr-10 6:19
Garry J Evans1-Apr-10 6:19 
GeneralRe: Error loading XML data Pin
billy_iii6-Apr-10 1:43
billy_iii6-Apr-10 1:43 
GeneralRe: Error loading XML data Pin
Garry J Evans6-Apr-10 2:54
Garry J Evans6-Apr-10 2:54 
QuestionDo I need to Dispose LINQ To SQL Data Context ? Pin
Nadia Monalisa1-Apr-10 1:35
Nadia Monalisa1-Apr-10 1:35 
AnswerRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
R. Giskard Reventlov1-Apr-10 1:41
R. Giskard Reventlov1-Apr-10 1:41 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Nadia Monalisa1-Apr-10 7:22
Nadia Monalisa1-Apr-10 7:22 
AnswerRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Not Active1-Apr-10 1:46
mentorNot Active1-Apr-10 1:46 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? [modified] Pin
Nadia Monalisa1-Apr-10 7:14
Nadia Monalisa1-Apr-10 7:14 

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.