Reflection offers the possibility to describe assemblies, modules and types. It enables you to access the attributes.
A compiled C# program is a relational database called metadata.
Example:
using System;
using System.Collections.Generic;using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace csharp
{public partial class Form1 : Form
{
public static int mNumber = 10;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Type objType = typeof(Form1);
FieldInfo field = objType.GetField("mNumber");
object objValue = field.GetValue(null);
MessageBox.Show(objValue.ToString());
}
}
}