Solved

DirectorySeparatorChar

Posted on 2013-05-23
3
182 Views
Last Modified: 2013-05-23
The statement below does not compile because of the DirectorySeparatorChar.
What should be used?
if (identitySection.UserName.IndexOfAny(System.IO.Path.DirectorySeparatorChar) > 0) {

Open in new window

0
Comment
Question by:allelopath
  • 2
3 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39192182
if (identitySection.UserName.IndexOfAny(new char[] { System.IO.Path.DirectorySeparatorChar }) > 0)
            {
            }

Open in new window


IndexOfAny expect array of char:
http://msdn.microsoft.com/en-us/library/system.string.indexofany.aspx
0
 
LVL 1

Author Comment

by:allelopath
ID: 39192214
Why an array of char? I just need one char.
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39192263
that's how the function is declared.
you can pass 1 char or many, but in order to support more than a single char, the passing argument must be an array.
so basically u pass an array with only 1 char, that is what the code do.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question