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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
Help Net Security
Help Net Security
Security Latest
Security Latest
Recorded Future
Recorded Future
S
Secure Thoughts
P
Privacy International News Feed
L
Lohrmann on Cybersecurity
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Google DeepMind News
Google DeepMind News
L
LINUX DO - 热门话题
T
The Blog of Author Tim Ferriss
T
Threatpost
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
V
Vulnerabilities – Threatpost
WordPress大学
WordPress大学
C
CERT Recently Published Vulnerability Notes
GbyAI
GbyAI
S
Schneier on Security
S
Security @ Cisco Blogs
S
Securelist
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
H
Heimdal Security Blog
D
DataBreaches.Net
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Schneier on Security
Schneier on Security
C
Check Point Blog
D
Docker

博客园 - angushine

获得本机IP地址 设置eclipse文件默认的编码方式 Eclipse Helios的PermGen space错误的解决办法 取指定长度的字符串(双字节算2) - angushine - 博客园 截取指定长度字符串 Silverlight项目无法启动调试 增强 VSS 的文件共享安全性 兼容各个版本浏览器的设置最小宽度 动态分配一维数组 浏览器区别 封装log4net C#获得调用方法的名称和类名 jQuery全选/全消CheckBox以及JS回调一例 MySQL绿色安装方法1 WebBrowser中调用加载页面的Javascript方法 定时更新内存和虚拟内存 多线程中更新组件 Request、Request.QueryString、Request.Form与Request.Params 开始→运行→输入的命令集锦(转载)
反射调用静态方法
angushine · 2009-10-12 · via 博客园 - angushine

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;namespace ConApp
{
    
class Program
    {
        
static void Main(string[] args)
        {
            
// 使用TryParse,出现异常时,赋值为最小值
            string str = "4x";
            DateTime dt 
= DateTime.MaxValue;
            DateTime.TryParse(str, 
out dt);// 使用TryParse,出现异常时,赋值为最小值
            int i = 2;
            
int.TryParse(str, out i);// 调用静态方法
            Type t = typeof(Sys);
            
object obj = t.InvokeMember("GetName",
                    BindingFlags.InvokeMethod 
| BindingFlags.Static | BindingFlags.Public, nullnullnew object[] { 2 });// 调用一般方法
            Type type = typeof(Sys);
            Object objT 
= type.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, nullnull, args); 
            
int ii = (int)type.InvokeMember("GetInt", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, objT, new object[] { 1 }); 

            Console.ReadKey();
        }
    }

public class Sys
    {
        
public static string GetName(int id)
        {
            
return string.Format("Your name is : test_{0}", id + 1);
        }
public int GetInt(int value)
        {
            
return value + 100;
        }
    }
}