[Mono-list] Reflection

Piers Haken piersh@friskit.com
Tue, 4 Feb 2003 21:40:32 -0800


This is a multi-part message in MIME format.

------_=_NextPart_001_01C2CCD9.190C4800
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Yes. In fact mono's own C# compiler, mcs, uses reflection extensively.

Reflection has no concept of a 'namespace' as such. However you can
query a Type for its namespace (as a string).

In order to enumerate all the namespaces of the loaded types you have
to:
1) get the list of assemblies from the appdomain
(AppDomain.CurrentDomain.GetAssemblies ())
2) get the list of types from the assemblies (assembly.GetTypes ())
3) build a set of namespaces from the individual types (type.Namespace)

Piers.

> -----Original Message-----
> From: Sanjaya Singharage [mailto:SanjayaS@jkcs.slt.lk]=20
> Sent: Tuesday, February 04, 2003 8:47 PM
> To: mono-list@lists.ximian.com
> Subject: [Mono-list] Reflection
>=20
>=20
> Hello,
> Is the System.Reflection class avaible in the current mono?=20
> Is there any tool that is provided with mono for discovering=20
> methods etc.? Can the Reflection class be used to discover=20
> classes in a given namespace? Can the Reflection class be=20
> used to discover all namespaces available? If not is there=20
> any other way to get this done? thanks.
>=20
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com=20
> http://lists.ximian.com/mailman/listinfo/mono-list
>=20

------_=_NextPart_001_01C2CCD9.190C4800
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.4417.0">
<TITLE>RE: [Mono-list] Reflection</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=3D2>Yes. In fact mono's own C# compiler, mcs, uses =
reflection extensively.</FONT>
</P>

<P><FONT SIZE=3D2>Reflection has no concept of a 'namespace' as such. =
However you can query a Type for its namespace (as a string).</FONT>
</P>

<P><FONT SIZE=3D2>In order to enumerate all the namespaces of the loaded =
types you have to:</FONT>

<BR><FONT SIZE=3D2>1) get the list of assemblies from the appdomain =
(AppDomain.CurrentDomain.GetAssemblies ())</FONT>

<BR><FONT SIZE=3D2>2) get the list of types from the assemblies =
(assembly.GetTypes ())</FONT>

<BR><FONT SIZE=3D2>3) build a set of namespaces from the individual =
types (type.Namespace)</FONT>
</P>

<P><FONT SIZE=3D2>Piers.</FONT>
</P>

<P><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>

<BR><FONT SIZE=3D2>&gt; From: Sanjaya Singharage [<A =
HREF=3D"mailto:SanjayaS@jkcs.slt.lk">mailto:SanjayaS@jkcs.slt.lk</A>] =
</FONT>

<BR><FONT SIZE=3D2>&gt; Sent: Tuesday, February 04, 2003 8:47 PM</FONT>

<BR><FONT SIZE=3D2>&gt; To: mono-list@lists.ximian.com</FONT>

<BR><FONT SIZE=3D2>&gt; Subject: [Mono-list] Reflection</FONT>

<BR><FONT SIZE=3D2>&gt; </FONT>

<BR><FONT SIZE=3D2>&gt; </FONT>

<BR><FONT SIZE=3D2>&gt; Hello,</FONT>

<BR><FONT SIZE=3D2>&gt; Is the System.Reflection class avaible in the =
current mono? </FONT>

<BR><FONT SIZE=3D2>&gt; Is there any tool that is provided with mono for =
discovering </FONT>

<BR><FONT SIZE=3D2>&gt; methods etc.? Can the Reflection class be used =
to discover </FONT>

<BR><FONT SIZE=3D2>&gt; classes in a given namespace? Can the Reflection =
class be </FONT>

<BR><FONT SIZE=3D2>&gt; used to discover all namespaces available? If =
not is there </FONT>

<BR><FONT SIZE=3D2>&gt; any other way to get this done? thanks.</FONT>

<BR><FONT SIZE=3D2>&gt; </FONT>

<BR><FONT SIZE=3D2>&gt; </FONT>

<BR><FONT SIZE=3D2>&gt; =
_______________________________________________</FONT>

<BR><FONT SIZE=3D2>&gt; Mono-list maillist&nbsp; -&nbsp; =
Mono-list@lists.ximian.com </FONT>

<BR><FONT SIZE=3D2>&gt; <A =
HREF=3D"http://lists.ximian.com/mailman/listinfo/mono-list">http://lists.=
ximian.com/mailman/listinfo/mono-list</A></FONT>

<BR><FONT SIZE=3D2>&gt; </FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C2CCD9.190C4800--