Solved

DirectorySeparatorChar

Posted on 2013-05-23
3
180 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now