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

推荐订阅源

AWS News Blog
AWS News Blog
T
Tenable Blog
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
T
Threatpost
Security Latest
Security Latest
C
Cisco Blogs
L
Lohrmann on Cybersecurity
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
NISL@THU
NISL@THU
AI
AI
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Hacker News: Front Page
U
Unit 42
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MyScale Blog
MyScale Blog
O
OpenAI News
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
P
Proofpoint News Feed
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyberwarzone
Cyberwarzone
博客园 - 【当耐特】
H
Heimdal Security Blog
S
Schneier on Security
阮一峰的网络日志
阮一峰的网络日志
Help Net Security
Help Net Security
D
DataBreaches.Net
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
WordPress大学
WordPress大学
P
Palo Alto Networks Blog

博客园 - 经霄

Microsoft ProClarity 6.3 releases to manufacturing Windows Services中使用MSBuild实现Build Automation Management VSS Object Model Google Service AS2005中的维度安全性简介【转】 学位英语通过,特此庆祝一下 VS2005常用插件 AMO编程 - 经霄 - 博客园 Analysis Management Object对象模型 华为前员工:揭密华为“薪酬真相”【转】 VS2005中读写配置文件(一) 微软笔试试题——11月13日,2005年 Structure of the Basic MDX Query(转) 使用ADOMD.NET建立与Analysis Services的连接 IT公司薪水调查 ADOMD.net概述 SQL与MDX语法的比较 AdventureWorks数据库的安装 多维联机数据分析模型和系统设计方法[转]
使用反射动态创建类的实例 - 经霄 - 博客园
经霄 · 2006-05-10 · via 博客园 - 经霄

   public interface IWriter
    
{
        
void Write();
    }

    
    
public class LogWriter:IWriter
    
{
        
public static int typeID;


        
IWriter Members
    }

  Assembly assembly = Assembly.GetExecutingAssembly();
            Module[] modules 
= assembly.GetModules();
            
if (modules != null)
            
{                   
                
foreach (Module obj in modules)
                
{
                    Type[] types 
= obj.GetTypes();
                    
foreach (Type objType in types)
                    
{
                        
if (objType.Name == "LogWriter")
                        
{
                            
try
                            
{
                                objType.InvokeMember(
"typeID", BindingFlags.SetField | BindingFlags.Public | BindingFlags.Static, nullnullnew object[] 1200 });
                                                        
                                IWriter writer 
=  (IWriter)Activator.CreateInstance(objType, false);
                                writer.Write();
                            }

                            
catch (Exception err)
                            
{
                                Console.WriteLine(err.Message);
                            }

                        }

                    }


                }

            }

Useful classes:

Assembly
Module
Type
Activator
System.Reflection namespace is essential before using these classes!