本文介绍了了解反射API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想了解ASP.Net c#中反射的概念,并想知道如何在ASP.Net中实现反射API?
I want to understand the concept of Reflection in ASP.Net c# and want to know how to implement Reflection API in ASP.Net ?
推荐答案
using System;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var t = typeof(MyClass);
foreach (var m in t.GetMethods())
{
Console.WriteLine(m.Name);
}
Console.ReadLine();
}
}
public class MyClass
{
public int Add(int x, int y)
{
return x + y;
}
public int Subtract(int x, int y)
{
return x - y;
}
}
}
For More Information You Can Refer The Link : Reflection in .NET[^]
这篇关于了解反射API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!