[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>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: Sanjaya Singharage [<A =
HREF=3D"mailto:SanjayaS@jkcs.slt.lk">mailto:SanjayaS@jkcs.slt.lk</A>] =
</FONT>
<BR><FONT SIZE=3D2>> Sent: Tuesday, February 04, 2003 8:47 PM</FONT>
<BR><FONT SIZE=3D2>> To: mono-list@lists.ximian.com</FONT>
<BR><FONT SIZE=3D2>> Subject: [Mono-list] Reflection</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Hello,</FONT>
<BR><FONT SIZE=3D2>> Is the System.Reflection class avaible in the =
current mono? </FONT>
<BR><FONT SIZE=3D2>> Is there any tool that is provided with mono for =
discovering </FONT>
<BR><FONT SIZE=3D2>> methods etc.? Can the Reflection class be used =
to discover </FONT>
<BR><FONT SIZE=3D2>> classes in a given namespace? Can the Reflection =
class be </FONT>
<BR><FONT SIZE=3D2>> used to discover all namespaces available? If =
not is there </FONT>
<BR><FONT SIZE=3D2>> any other way to get this done? thanks.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> =
_______________________________________________</FONT>
<BR><FONT SIZE=3D2>> Mono-list maillist - =
Mono-list@lists.ximian.com </FONT>
<BR><FONT SIZE=3D2>> <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>> </FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C2CCD9.190C4800--