TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nagendra Panyam
NA
190
17.5k
linq avoiding foreach loop
Feb 19 2019 6:21 AM
can any one say how to avoid foreach loop because drive letter is compared to all drives ithink its laggs my application
public static bool IsDriveReady(char driveLetter)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo driveInfo in allDrives)
{
char drive = driveInfo.Name.ToUpper(CultureInfo.InvariantCulture)[0];
if (drive.CompareTo(driveLetter) == 0)
{
return driveInfo.IsReady;
}
}
return false;
}
Reply
Answers (
4
)
how to design the attractive layoutpage in bootstrap n mvc?
Asp.net form to Html