Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DirectorySeparatorChar

Posted on 2013-05-23
3
Medium Priority
?
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

661 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