DotNet Array

G8tor
Member Posts: 29
Hello
I have an external dll component that has a function that takes array of another dotnet object as a parameter.
The function is something like this: sendCustomer(Customer[]).
How can I create .net array that contains custom object. I read at http://vjeko.com/blog/generics-in-net-interop-for-nav-2013 that you could use array like this:
Arr := Arr.CreateInstance(GETDOTNETTYPE(Type),2);
Arr.SetValue(GETDOTNETTYPE(String),0);
Arr.SetValue(GETDOTNETTYPE(Int),1);
This is not working for me because im using custom DotNet object and the error message I get is that the dotnet array is not initialized.
Does anyone have any solution for me or any example of how to use dotnet array?
Cheers
I have an external dll component that has a function that takes array of another dotnet object as a parameter.
The function is something like this: sendCustomer(Customer[]).
How can I create .net array that contains custom object. I read at http://vjeko.com/blog/generics-in-net-interop-for-nav-2013 that you could use array like this:
Arr := Arr.CreateInstance(GETDOTNETTYPE(Type),2);
Arr.SetValue(GETDOTNETTYPE(String),0);
Arr.SetValue(GETDOTNETTYPE(Int),1);
This is not working for me because im using custom DotNet object and the error message I get is that the dotnet array is not initialized.
Does anyone have any solution for me or any example of how to use dotnet array?
Cheers
0
Comments
-
-
System.Collections.ArrayList.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'1
-
Actually what I am looking for is a params String[]. In C# you can simply do somethinglike this:
"<Parameter 1>", "<Parameter 2>"
But in NAV it is expecting one dotnet paramter of params String[].
Any thoughts?Jason Wilder
jwilder@stonewallkitchen.com0 -
Hi, try to use DotNET variable Array and try something like this:
ParamsArr := ParamsArr.CreateInstance(GETDOTNETTYPE(Param1), 2); ParamsArr.SetValue(Param1, 0); ParamsArr.SetValue(Param2, 1);
But I also can't get thru it in more complex functions with overloading a nullable params - like BouncyCastleCert[] chain ...Regards
xStepa0 -
This is not working, here is what I have for variables:
ParamsArr DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Param1 DotNet System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Param2 DotNet System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
I don't think this addresses the params keyword needed to allow this to not error during runtime. By the way it is the typical not so helpful error when parameters do not match that I get when I run my code:
Jason Wilder
jwilder@stonewallkitchen.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions