<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for Write your own Reflector - by Alain &quot;Lino&quot; Tadros</title>
<link rel="alternate" type="text/plain" href="http://dn.codegear.com/article/29423" title="Write your own Reflector - by Alain &quot;Lino&quot; Tadros" />
<link rel="self" type="application/atom+xml" href="http://dn.codegear.com/article/29423/feed" title="Comments for Write your own Reflector - by Alain &quot;Lino&quot; Tadros" />
<id>http://dn.codegear.com/article/29423</id>
<updated>2008-11-21T15:53:49-08:00</updated>
<entry>
<title>Write your own Reflector - by Alain </title>
<author>
<name>hallgrim flatland</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=34357</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=34357</id>
<updated>2003-03-27T05:53:13-07:00</updated>
<published>2003-03-27T05:53:13-07:00</published>
<summary>Write your own Reflector - by Alain </summary>
<content>I follow these articles from a C# point of view. I took the liberty in translating the reflection example into C#. (Obs. I load the \Microsoft.NET\Framework\v1.0.3705\mscorlib.dll in this example).Compile with &quot;csc *.cs&quot; and run ReflectionDemo.exeReflectionDemo.cs:using System.Windows.Forms;using Reflection.Form;namespace Reflection{public class ReflectionDemo{public static void Main(){ReflectionForm theReflectionForm = new ReflectionForm();Application.Run(theReflectionForm);}}}ReflectionForm.cs:using System;using System.Windows.Forms;using System.ComponentModel;using System.Drawing;using System.Reflection;namespace Reflection.Form{public class ReflectionForm : System.Windows.Forms.Form{private Container PreContainer;private StatusBar stBar;private Button btnLoad;private TreeView TV;public void btnLoad_Click(Object Sender, EventArgs E){String SysRoot;Assembly Assm;System.Type[] t;int i, iprop;int PropertyCount = 0;int MethodCount = 0;int FieldCount = 0;int EventCount = 0;;TreeNode TN, TNProp, TNMethod, TNEvent, TNField;SysRoot = Environment.GetEnvironmentVariable(&quot;systemroot&quot;);try{Assm = Assembly.LoadFrom(SysRoot + &quot;\\Microsoft.NET\\Framework\\v1.0.3705\\mscorlib.dll&quot;);t = Assm.GetTypes();for (i = 0; i &lt; Assm.GetTypes().Length; i++){TN = TV.Nodes.Add(t[i].Name);PropertyCount = PropertyCount + t[i].GetProperties().GetUpperBound(0) + 1;TNProp = TN.Nodes.Add(&quot;Properties&quot;);for (iprop = 0; iprop &lt; t[i].GetProperties().Length; iprop++)TNProp.Nodes.Add(t[i].GetProperties().GetValue(iprop).ToString());MethodCount = MethodCount + t[i].GetMethods().GetUpperBound(0) + 1;TNMethod = TN.Nodes.Add(&quot;Methods&quot;);for (iprop = 0; iprop &lt; t[i].GetMethods().Length; iprop++)TNMethod.Nodes.Add(t[i].GetMethods().GetValue(iprop).ToString());FieldCount = FieldCount + t[i].GetFields().GetUpperBound(0) + 1;TNField = TN.Nodes.Add(&quot;Fields&quot;);for (iprop= 0; iprop &lt; t[i].GetFields().Length; iprop++)TNField.Nodes.Add(t[i].GetFields().GetValue(iprop).ToString());EventCount = EventCount + t[i].GetEvents().GetUpperBound(0) + 1;TNEvent = TN.Nodes.Add(&quot;Events&quot;);for (iprop = 0; iprop &lt; t[i].GetEvents().Length; iprop++)TNEvent.Nodes.Add(t[i].GetEvents().GetValue(iprop).ToString());}}catch(Exception ex){MessageBox.Show(&quot;Kaboom!! Problems loading the assembly: &quot; + ex.Message); //implement your own exception handling here.}this.Text = &quot;Properties=&quot; + System.Convert.ToString(PropertyCount) + &quot;  Methods=&quot; + System.Convert.ToString(MethodCount) + &quot; Fields=&quot; + System.Convert.ToString(FieldCount) + &quot; Events=&quot; + System.Convert.ToString(EventCount);stBar.Text = &quot;Done&quot;;}public ReflectionForm() : base(){Initialize();}public void Initialize(){Control[] MyControls = new Control[3];MyControls.Initialize();this.PreContainer = new System.ComponentModel.Container();this.TV = new TreeView();this.stBar = new StatusBar();this.btnLoad = new Button();this.TV.Size = new Size(584, 336);this.TV.TabIndex = 0;this.TV.Anchor = ((AnchorStyles.Top) |(AnchorStyles.Bottom) |(AnchorStyles.Left) |(AnchorStyles.Right));this.TV.Location = new Point(8, 8);this.AutoScaleBaseSize = new Size(5, 13);this.Text = &quot;Reflection Demo&quot;;this.AcceptButton = btnLoad as IButtonControl;this.ClientSize = new Size(600, 400);this.stBar.BackColor = SystemColors.Control;this.stBar.Location = new Point(0, 397);this.stBar.Size = new Size(600, 16);this.stBar.TabIndex = 2;this.stBar.Text = &quot;Click to Reflect&quot;;this.btnLoad.Anchor = ((AnchorStyles.Right) | (AnchorStyles.Bottom));this.btnLoad.Click += new EventHandler(btnLoad_Click);this.btnLoad.FlatStyle = FlatStyle.Flat;this.btnLoad.Location = new Point(480, 352);this.btnLoad.Size = new Size(112, 32);this.btnLoad.TabIndex = 1;this.btnLoad.Text = &quot;&amp;Reflect&quot;;MyControls[0] = this.stBar;MyControls[1] = this.btnLoad;MyControls[2] = TV;this.Controls.AddRange(MyControls);}}}</content>
</entry>
<entry>
<title>Write your own Reflector - by Alain </title>
<author>
<name>Stephane JOUANNEAU</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33932</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33932</id>
<updated>2003-01-18T08:05:50-08:00</updated>
<published>2003-01-18T08:05:50-08:00</published>
<summary>Write your own Reflector - by Alain </summary>
<content>if you don't have more than the official &#178;Net framework downloaded, make caution to modify the :\Microsoft.NET\Framework\v1.1.4322\mscorlib.dllin\Microsoft.NET\Framework\v1.0.3705\mscorlib.dllWorks very fine !!Regards from DoubleTree in S.J.stjo.com - stjo.net&#178;Net Borland France</content>
</entry>
</feed>
