Click here to Skip to main content
15,889,403 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Calling instances of Winforms from dlls Pin
mav.northwind14-Feb-05 2:50
mav.northwind14-Feb-05 2:50 
GeneralRe: C# Calling instances of Winforms from dlls Pin
jslater14-Feb-05 7:16
jslater14-Feb-05 7:16 
GeneralC# help Pin
maheshfour14-Feb-05 0:36
maheshfour14-Feb-05 0:36 
GeneralPreserving whitespaces while serialization Pin
APradosh14-Feb-05 0:23
APradosh14-Feb-05 0:23 
Questionmessage pump - hidden window - how? Pin
jcl55513-Feb-05 23:47
jcl55513-Feb-05 23:47 
Generalon obfuscation Pin
ppp00113-Feb-05 23:39
ppp00113-Feb-05 23:39 
GeneralRe: on obfuscation Pin
Seraphin13-Feb-05 23:48
Seraphin13-Feb-05 23:48 
GeneralReflection Problem... Pin
Norman-Timo13-Feb-05 23:12
Norman-Timo13-Feb-05 23:12 
Hello C#-Comunity!

I have a little problem using Reflection under C#.

I defined an abstract class with a static method in an assembly '.dll'-file.

In source code it looks like:

<br />
<br />
public abstract class MyClass<br />
{<br />
<br />
   // ...<br />
<br />
   public static int MyStaticMethod(int paraNumber)<br />
   {<br />
      // ...<br />
   }<br />
<br />
}<br />
<br />


This code is compiled as a '.dll' file. Then it´s not implemented via Reference in Visual Studio, but as an reflection-load with the
'System.Reflection.Assembly.LoadFile(...)' - statement.

My problem is to invoke the static method in this abstract class via reflection.

With the statements:
<br />
<br />
Type MyMetaObject = assembly.GetType("MyClass", true, true);<br />
<br />
object[] parameters = new object[1];<br />
parameters[0] = (object) paraNumber;<br />
<br />
object retObject = MyClass.("MyStaticMethod", System.Reflection.BindingFlags.InvokeMethod, null, ?X?, parameters);<br />
<br />


This doesn´t work Frown | :-(

I think the problem is the '?X?', because I tried it with 'null', but it causes a runtime error like 'Object reference is not set to an instance of object' [or something like that].

Normally the '?X?' parameter is for an instance of the object which method will be invoked, but I can´t create an instance from an abstract class object!

Has anybody some solution proposals?

Thanx for any help!

Ciao
Norman-Timo
GeneralRe: Reflection Problem... Pin
leppie14-Feb-05 0:47
leppie14-Feb-05 0:47 
GeneralRe: Reflection Problem... Pin
Norman-Timo14-Feb-05 2:43
Norman-Timo14-Feb-05 2:43 
QuestionHow to determine RightToLeft Pin
Member 122568913-Feb-05 22:51
Member 122568913-Feb-05 22:51 
Generalexport datagrid to powerpoint Pin
pooja_a2813-Feb-05 22:35
pooja_a2813-Feb-05 22:35 
GeneralModem &amp; Phone [C#.Net] Pin
| Muhammad Waqas Butt |13-Feb-05 21:57
professional| Muhammad Waqas Butt |13-Feb-05 21:57 
GeneralRe: Modem &amp; Phone [C#.Net] Pin
Dave Kreskowiak14-Feb-05 5:57
mveDave Kreskowiak14-Feb-05 5:57 
GeneralRe: Modem &amp; Phone [C#.Net] Pin
| Muhammad Waqas Butt |14-Feb-05 21:38
professional| Muhammad Waqas Butt |14-Feb-05 21:38 
GeneralRe: Modem &amp; Phone [C#.Net] Pin
Dave Kreskowiak15-Feb-05 1:54
mveDave Kreskowiak15-Feb-05 1:54 
GeneralLicense Key Pin
vchalla13-Feb-05 21:57
vchalla13-Feb-05 21:57 
GeneralRe: License Key Pin
Member 170427313-Feb-05 22:29
Member 170427313-Feb-05 22:29 
GeneralEncoding images for use in PDFs Pin
myfriendofmisery13-Feb-05 20:56
myfriendofmisery13-Feb-05 20:56 
Generalcheck existence data in crystal report Pin
ye win zaw13-Feb-05 19:48
ye win zaw13-Feb-05 19:48 
Questioncan we update the records present in a datagrid Pin
meena198313-Feb-05 18:03
meena198313-Feb-05 18:03 
Generalexporting web pages to word documents Pin
Member 172938213-Feb-05 17:27
Member 172938213-Feb-05 17:27 
GeneralRe: exporting web pages to word documents Pin
Dave Kreskowiak14-Feb-05 5:54
mveDave Kreskowiak14-Feb-05 5:54 
GeneralRe: exporting web pages to word documents Pin
Member 172938214-Feb-05 13:13
Member 172938214-Feb-05 13:13 
GeneralRe: exporting web pages to word documents Pin
Dave Kreskowiak14-Feb-05 14:32
mveDave Kreskowiak14-Feb-05 14:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.