473,657 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic arrays..//coming from Delphi

Hi,
What can I use in C# for dynamic arrays ???? I have some records (struts in
..Net) and want to store them in a dynamic "arrays" or object list.

I noticed the in C# arrays' length can't be extented in run time. So, what
should I use ?

Thank You in advance.

PS:
In Delphi/Pascal I would do something like :

type
aEmployee = record
Name : string;
LastName : String;
DOB :TDatetime;
end;

var
OurListOfEmploy ees : array of aEmployee;
Nov 16 '05 #1
3 2811
You can use an ArrayList. Or you can write your own array extending
(allocate new array, copy old items over).

-mike
MVP

"genc ymeri" <ge********@hot mail.com> wrote in message
news:OT******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
What can I use in C# for dynamic arrays ???? I have some records (struts
in
.Net) and want to store them in a dynamic "arrays" or object list.

I noticed the in C# arrays' length can't be extented in run time. So, what
should I use ?

Thank You in advance.

PS:
In Delphi/Pascal I would do something like :

type
aEmployee = record
Name : string;
LastName : String;
DOB :TDatetime;
end;

var
OurListOfEmploy ees : array of aEmployee;


Nov 16 '05 #2
DC
genc ymeri wrote:
// coming from Delphi There are quite a lot of us here... <G>
What can I use in C# for dynamic arrays ???? I have some records (struts in
.Net) and want to store them in a dynamic "arrays" or object list.


struct aEmployee
{
public string Name;
public string LastName;
public DateTime DOB;
}

....
....

ArrayList ourListOfEmploy ees = new ArrayList();

aEmployee emp;

emp = new aEmployee();
emp.Name = "Dejan";
ourListOfEmploy ees.Add(emp);

emp = new aEmployee();
emp.Name = "Genc";
ourListOfEmploy ees.Add(emp);

....
etc
....
LP,
Dejan
Nov 16 '05 #3

"DC" <dc@nospam.ne t> wrote in message
news:uL******** ******@TK2MSFTN GP12.phx.gbl...
genc ymeri wrote:
// coming from Delphi There are quite a lot of us here... <G>
What can I use in C# for dynamic arrays ???? I have some records (struts
in
.Net) and want to store them in a dynamic "arrays" or object list.


struct aEmployee
{
public string Name;
public string LastName;
public DateTime DOB;
}


I'd advise using a class here, otherwise when you unbox from the ArrayList,
you'll have to reinsert the object or your updates won't be maintained.
...
...

ArrayList ourListOfEmploy ees = new ArrayList();

aEmployee emp;

emp = new aEmployee();
emp.Name = "Dejan";
ourListOfEmploy ees.Add(emp);

emp = new aEmployee();
emp.Name = "Genc";
ourListOfEmploy ees.Add(emp);

...
etc
...
LP,
Dejan

Nov 16 '05 #4

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

Similar topics

4
7672
by: Scott Lyons | last post by:
Hey all, Can someone help me figure out how to pass a dynamic array into a function? Its been giving me some trouble, and my textbook of course doesnt cover the issue. Its probably something simple, but its just not popping into my mind at the moment. My little snippet of code is below. Basically, the studentID array is dynamic so it will fit any length of a Student's Name. What I'm trying to do is place this chunk of code into a...
18
1831
by: spiffo | last post by:
The Main Issue in a nutshell I am a corporate developer, working for a single company. Got a new project coming up and wondering if I should stay with Python for this new, fairly large project, are jump back on the 'safe' M$ bandwagon using a dot net language? Cross platform is NOT an issue, but COMPLETE control/compatability with MsSql Server (current and future versions) certainly is. Quick History
5
2210
by: Just call me James | last post by:
Hi, Coming away from the luxury of the delphi IDE has been something of a shock. As a consequence I've become aware that maybe I need to spend some money on a python IDE. As a beginner I reckon integrated debugging would be helpful.
4
2465
by: learnfpga | last post by:
Here is a little code I wrote to add the numbers input by the user.....I was wondering if its possible to have the same functionality without using dynamic arrays.....just curious..... //trying to get input from the user to add all the numbers that user inputs //tried to do it without dynamic memory usage but probably cannot achieve it //here is using "new" and "delete" operator....
2
7046
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
4
5060
by: hobbes992 | last post by:
Howdy folks, I've been working on a c project, compiling using gcc, and I've reached a problem. The assignment requires creation of a two-level directory file system. No files have to be added or deleted, however it must be initialized by a function during run-time to contain so many users which each contain so many directories of which each contain so many files. I've completed the program and have it running flawlessly without implementing...
9
18541
by: johndale | last post by:
hi, I am pretty new to C#, but have some experience with other lang.(delphi,php,asp...). I wanted to create dynamic array of structs type, but it wont work. So I google it, and found that C#.NET CAN NOT work with dynamic arrays... (pretty weird) So I want to please more experienced C# programmers to help me with my elementary problem, which grows into nightmare :-) All I want is simple data structure: 1. Structs type called Bar ...
0
1535
by: bhuvanvel | last post by:
Sir!, i'm intermediate level user for action script, i'm trying to text effects as Explosion with dynamic array. everything i getting dynamic textfield to enter the text.. the effects is not coming.. but its effects is working as reversely .!. give me a example
4
5420
by: Sunny | last post by:
Hi, Is there a way in javascript to create Dynamic arrays or arrays on fly. Something Like: var "ptsgN"+sd = new Array(); Here sd is incrementing by 1. I have lots of data that I am putting in arrays.
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.