日期:2014-05-18 浏览次数:20744 次
using System.IO; using System.Runtime.InteropServices; namespace CSCOMLib { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [ComVisible(true)] public interface IDirectory4COM { string[] GetAllFiles(string directory); bool IsExistsDir(string directory); } [Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),ClassInterface(ClassInterfaceType.None)] [ComSourceInterfaces((typeof(IDirectory4COM)))] [ComVisible(true)] public class Directory4COM : IDirectory4COM { [ComVisible(true)] public string[] GetAllFiles(string directory) { return Directory.GetFiles(directory); } [ComVisible(true)] public bool IsExistsDir(string directory) { return Directory.Exists(directory); } } }