首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
首页标签reflection

#reflection

Reflection -获取属性的名称和值

要在字典中获取属性的所有属性: typeof(Book) .GetProperty("Name") .GetCustomAttributes(false) .ToDictionary(a => a.GetType().Name, a => a); 如果还想包含继承的属性,将其更改为false。... 展开详请

如何获取代码所在的程序集的路径?

大叔也犯二为了此岸的完整构建永无法到达的彼岸
希望对你有帮助 //get the full location of the assembly with DaoTests in it string fullPath = System.Reflection.Assembly.GetAssembly(typeof(DaoTests)).Location; //get the folder that's in string theDirectory = Path.GetDirectoryName( fullPath );... 展开详请
领券