惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 山顶洞外人

k8s部署dengine-3.3.6.9 wsl 磁盘 SQL 写法对比 关于达梦8管理工具执行多行sql语法错误问题 idea 中无法连接 sql server 数据库,报错 [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接 TransactionScope 图片扩容 已将此 订阅标记为不活动,必须将其重新初始化。需要删除NoSync 订阅,然后重新创建它们 visual studio 2017 将winform 打包成 msi 安装文件 漏洞处理 - 山顶洞外人 阿里云物联网测试 net core3.1 + electron 9.31.2 项目初始化 delete in 事故清表 sql 脚本执行时间 webapi filter 分组后条件查询 一行拆多行 有关数据库锁表 order by 排序的数字异常
从C#接口的属性获取多个实现类中字段的值
山顶洞外人 · 2024-02-22 · via 博客园 - 山顶洞外人
        private List<string> GetImplName()
        {
            List<string> ls = new List<string>();

            var types = AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IBaseContainer))))
                        .ToArray();
            foreach (var v in types)
            {
                object ct = Activator.CreateInstance(v);
                string name = (string)v.GetProperty("Name").GetValue(ct, null);
                ls.Add($"{name}");
            }
            return ls;
        }
    public interface IBaseContainer
    {
        /// <summary>
        /// 类型名字,属性访问器,访问实现类中的_name字段
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 数据保存
        /// </summary>
        void Save();
        /// <summary>
        /// 数据组合构建
        /// </summary>
        void DataBuild(SlnClass slnClass);
    }
    public class DMImpl : IBaseContainer
    {
        private string _name = "DM";

        public string Name => _name;

        public void DataBuild(SlnClass slnClass)
        {
            throw new NotImplementedException();
        }

        public void Save()
        {
            throw new NotImplementedException();
        }

    }

posted @ 2024-02-22 14:58  山顶洞外人  阅读(35)  评论()    收藏  举报