473,388 Members | 1,342 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,388 software developers and data experts.

redimension arrays of Interface objects

HI,

how to redimension an array in c#, and preserve it's
contents (without using arraylist).

In visual basic it...
Dim I_interfaceArray() as I_interface = new I_interface()
{objInterface}

Redim Preserve I_interfaceArray(2)

but I don't find a way to do this in C#.
c#....
I_interface[] I_interfaceArray = new I_interface()
{objInterface}

// redimension new array here....
I_interfaceArray = new I_interface[2] // ?????
I have an object that i got off the internet somewhere,
that does this for you (in c#), but it won't work on
interfaces, because it returns an array of objects(object
[])
Thanks
Nov 15 '05 #1
1 2853
Kurt,

You can not do it in C# unless you create a new array and copy over the
elements from the old array to the new array. Otherwise, using an array
list is the only way to go for now.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kurt Lange" <la********@hotmail.com> wrote in message
news:0d****************************@phx.gbl...
HI,

how to redimension an array in c#, and preserve it's
contents (without using arraylist).

In visual basic it...
Dim I_interfaceArray() as I_interface = new I_interface()
{objInterface}

Redim Preserve I_interfaceArray(2)

but I don't find a way to do this in C#.
c#....
I_interface[] I_interfaceArray = new I_interface()
{objInterface}

// redimension new array here....
I_interfaceArray = new I_interface[2] // ?????
I have an object that i got off the internet somewhere,
that does this for you (in c#), but it won't work on
interfaces, because it returns an array of objects(object
[])
Thanks

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: Christopher Benson-Manica | last post by:
If an array is sparse, say something like var foo=; foo=4; foo='baz'; foo='moo'; is there a way to iterate through the entire array? --
5
by: y | last post by:
Hi, I have an array with 2 elements and I would like to keep the elements but redimension the array so that I can add another value. How do I do this. I have tried this but, i think I have...
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: >...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
25
by: Jack | last post by:
Hi, Is there a general solution for the following problem: I have an array of instances of class B. Class B is publicly derived from class A. Then I have a class named Buffer that generally...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
3
by: Logan | last post by:
Greetings to all, i need to create a matrix (or something that make the job) to store 3 values per row to insert everything (there will be several rows) later in my database but i canĀ“t find a way...
4
by: Olumide | last post by:
Hello - I have two classes A and B as follows: class B{ public: ~B(){ cout << "destroying B" << endl; } }; class A{
12
by: gnewsgroup | last post by:
I've read the msdn doc about IEnumerable. It seems to me that IEnumerable objects are essentially wrapped-up arrays. It simply gives us the foreach convenience. Is this correct?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.