directoryinfo

Is there an async version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet?

家住魔仙堡 提交于 2019-11-27 01:02:15
问题 Is there an asynchronous version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet? I'd like to use them in an F# async block, and it'd be nice to have a version that can be called with AsyncCallbacks. Problem is I'm trying to suck in a bunch of directories, probably on SMB mounts over slow network connections, and I don't want a bunch of thread pool threads sitting around waiting for network reads when they could be doing other work. 回答1: No, I don't think there is. The pool

C#: How to logon to a share when using DirectoryInfo

血红的双手。 提交于 2019-11-26 22:23:38
问题 If I want to instantiate a DirectoryInfo object with an UNC path DirectoryInfo myDI = new DirectoryInfo (@"\\server\share"); how can I pass a username / password that is required to access that share? Thanks 回答1: In .NET 4 this class works perfectly for me to logon in none windows server via UNC. using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Web; using System