获取msdn的API
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
namespace api_get {
class Program {
static void Main(string[] args) {
string programfiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string path = Path.Combine(programfiles, @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client");
foreach (string each in Directory.GetFiles(path, "*.dll")) {
Assembly assembly = Assembly.LoadFrom(each);
Type[] cla = assembly.GetTypes();
foreach (Type t in cla) {
Console.WriteLine("Class is " + t);
Console.WriteLine("http://msdn.microsoft.con/en-us/library/{0}/{1}.aspx", Path.GetFileNameWithoutExtension(each), t);
Type type = t.GetType();
var methods = type.GetMethods();
var property = type.GetProperties();
//WebClient wc = new WebClient();
foreach (MethodInfo met in methods) {
Console.WriteLine("Methdod is " + met);
}
foreach (PropertyInfo pro in property) {
Console.WriteLine("Property is " + pro);
Console.WriteLine("http://msdn.microsoft.con/en-us/library/{0}/{1}.{2}.aspx", Path.GetFileNameWithoutExtension(each), t, pro);
}
Console.ReadKey();
}
Console.ReadKey();
}
Console.ReadKey();
}
}
}
要获得msdn的类,以及它的方法属性等,通过Environment类,Path类,Directory类和aeembly类来获得其中的每一项,再依次读出来即可。由于单个页面可能不能显示出所有,通过Console.ReadKey()来实现分开显示效果。