473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to marshal a dynamic sized array

Hi All,

This is a problem which is eating my head from several days.

I have a structure which contains an array of elements as


public byte[] pinNumbers;


To use it in my C# class i need to marshall it as

[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.U1, SizeConst = 6)]
public byte[] pinNumbers
;

But here using this marshalling technique , I was forced to pass a fixed size for the array as SizeConst = 6,
but now i have several arrays which are dynamic arrays whose sizeconst has to be determined at the runtime.

How can i Marshal dynamic arrays using any marshalling technique ?

please provide me with a solution as i have tried a lot to marshal arrays using other marshalling styles as well.

Thanks
Eric Haas
Oct 16 '08 #1
3 3269
r035198x
13,262 8TB
Can't you use a constant variable in SizeConst = aContantVariable?
P.S By dynamic array you mean ArrayList?
Oct 16 '08 #2
Thanks for replying

yes by dynamic array i mean varaible length array whose size can not be fixed it has to be passed at run time.

passing a const size is not what is required in the program.
Oct 16 '08 #3
Did you ever find a solution for this? I'm trying to do the same thing.
Feb 12 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Ronny Mandal | last post by:
Assume that you want to store n records in an array, and that the array can hold all n elements, that is, it is declared int a. And suddenlny in run-time, I need to store n+m items. Why cannot...
1
by: dhornyak | last post by:
I have been banging my head against the wall for a while now, and can't seem to id the problem. I've been through a ton of posts and the code doesn't seem any different. Can anybody see it? When...
60
by: Peter Olcott | last post by:
I need to know how to get the solution mentioned below to work. The solution is from gbayles Jan 29 2001, 12:50 pm, link is provided below: >...
3
by: Nikesh | last post by:
project is abt encrypting a txt file with an image.... in that i will to accept a txt file from the user ..this file a need to be stored in an array...thus file size will keep on changing....and...
10
by: Zytan | last post by:
This article: http://www.c-sharpcorner.com/UploadFile/mahesh/WorkingWithArrays11142005060354AM/WorkingWithArrays.aspx claims that "In C#, arrays can be declared as fixed length or dynamic". I...
7
by: repekto.argosoft | last post by:
Hi, I'm working with Marshalling. I got an idea to pass an object to the Native side as a byte array i.e. as void* in terms of C. For example: I have a .NET structure Point that contains...
13
by: kwikius | last post by:
Does anyone know what a C99 dynamic array is, and if it will be useable in C++? regards Andy Little
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
2
by: O.B. | last post by:
I have operation within a class that marshals the data into a byte array. Below are three different ways that work. Are there any downsides to using one over the the other? public virtual byte...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.