MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

.NET/LINK USER GUIDE Comment: Calling static generic C# method

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105096] .NET/LINK USER GUIDE Comment: Calling static generic C# method
  • From: wollmich <wollmich at gmail.com>
  • Date: Sat, 21 Nov 2009 03:31:41 -0500 (EST)

Hi,

I've a problem to call a static generic C# method from Mathematica and
I don't find any example on the web or in your user guide.
http://www.wolfram.com/learningcenter/tutorialcollection/NETLinkUserGuide/NETLinkUserGuide.pdf

Calling a non static class (this works):
Type1 = LoadNETType["DummyLib.Class1"];
Object1 = NETNew[Type1];
Object1@Method1[];

Calling a static method in a static class (this works):
Type2 = LoadNETType["DummyLib.Class2"];
Class2`Method2[];

Calling a non static but generic class  (this works):
Type3 = LoadNETType["DummyLib.Class3`1[[DummyLib.Class1]]"];
Object3 = NETNew[Type3];
Object3@Method3[];

Calling a static generic method in a static class (THIS DOESN'T
WORK!!!!) I've no idea how to call it???
The method could look like that in C#:
C#-Code:
namespace DummyLib
{
    public static class Class4
    {
        public static T Method4<T>()
            where T : new()
        {
            return new T();
        }
    }
}

With NETTypeInfo the method is listet, but I don't no idea how to pass
the type parameter?
Type4 = LoadNETType["DummyLib.Class4"];
NETTypeInfo[Type4];

Can somebody please help me. Thanks.

Regards Wollmich


  • Prev by Date: Flat attribute and order of function definitions
  • Next by Date: Re: PolarPlot goes upto 1.2 on axis, not 1?
  • Previous by thread: Re: Flat attribute and order of function definitions
  • Next by thread: Re: .NET/LINK USER GUIDE Comment: Calling static generic C# method