[Mono-list] Reflection problem
Jackson Harper
jackson@latitudegeo.com
Fri, 14 Mar 2003 08:38:58 -0800
System.Math does not have a default contructor, you can't create an
instance of it, all of its methods and fields are static. Try
System.Object instead.
Jackson
Carlos Alberto Cortez wrote:
>Hello there:
>
>Yesterday I began to have fun with reflection. But I had a problem, when
>I wrote this code:
>
>using System;
>using System.Reflection;
>
> public class ReflectionTest {
>
> public static void Main () {
>
> Type theMathType = Type.GetType("System.Math");
> Object theObj = Activator.CreateInstance(theMathType);
>
> }
>
> }
>
>When I compile it, no error messages are shown, but when i try to run
>it, the next message appears:
>
>Unhandled Exception: System.MissingMethodException: Default constructor
>not found
>in <0x0019b> 00 System.Activator:CreateInstance (System.Type,bool)
>in <0x00031> 00 .ReflectionTest:Main ()
>
>have anybody any idea about this problem?
>
>Regargds,
>Carlos.
>
>
>