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

How to implement my array/collection

Hi, I have just migrated to C#. I need some advice on the following
problem:
I need to create an object/structure with characteristics A,B and C. A
and B are Integers while C consists of 2 Integers. I need to store
data in these, every 5 sec or so, each value with a DateTime stamp/
index. I will need a method to write the value with the DateTime.
Another method to get the value for a specific DateTime. However, for
getting the value, there might not be a corresponding DateTime index.
In that case, the value closes to that time should be provided. What
is the best method of implementing this? I would require ten instances
of this object at any time. PLease advice.
Thanks
Maddy
Mar 18 '08 #1
4 1555
Thanks for the ideas. Few things however-
When I said only 10 objects, I meant the entire object. A,B and C
would have about 400 to 500 values. Would have so many values in
memory slow down the app? Should I save them more often to a file?
Secondly each A, B and C need an individual timestamp.
Mar 20 '08 #2
On 20 Mar, 02:28, Maddy <mniti...@gmail.comwrote:
Thanks for the ideas. Few things however-
When I said only 10 objects, I meant the entire object. A,B and C
would have about 400 to 500 values. Would have so many values in
memory slow down the app? Should I save them more often to a file?
Secondly each A, B and C need an individual timestamp.
OK - can I just double check what you are describing? In terms of a
visualisation, do you mean:

SomeList [~10 of]
"A"s
int, timstamp pair [~500 of]
"B"s
int, timestamp pair [~500 of]
"C"s
int,int,timestamp triple [~500 of]
or do you mean:

SomeList [~10 of]
Items [~500 of]
timestamp, int "A", int "B", {int/int} "C"
- i.e. are A/B/C timstamped separately, or is it each combination of
an A,B & C that is timstamped.

Also 500 is not a big number. I wouldn't worry about memory - but how
often do you need to seach it for a value (by date)? knowing that
might help pick the most suitable structure. If it is infrequent (i.e.
5s, the only timing in your post) then I wouldn't get excited, and
would just use a List search (as already posted). [In any event, keep
the data in timestamp sequence]
If it is more frequent than this, then perhaps a binary search - or if
you know the data is coming in at regular intervals (every 5s) you
could use interpolation of the query value between the start/end
values to find a first guess and then hunt from here.

Let me know how often you search and I'll try to knock an example
together...

Marc
Mar 20 '08 #3
To be honest, if you are thinking of using disk storage, and the rate
is only every 5-10s, why not just pump everything into a database and
use SQL to do it? It would be a lot simpler, and you wouldn't have to
worry about the difference between in memory and persisted. SQL
Express is free and more than up to this - blus LINQ-to-SQL should be
able to cope with expressions like the one in my early posts.

I still don't really understand the A/B/C mapping...

Marc
Mar 22 '08 #4
I'll re-read on Tuesday (long weekend) - but in real terms I would
consider "install SQL Express" a very simple option...
Mar 24 '08 #5

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

Similar topics

4
by: Sasha | last post by:
Hi everyone, What is the best way to implement many-to-many relationship between objects? Any examples or links are welcome! Thank you, Sasha
1
by: Matt | last post by:
What is the major differences between array and collection? For example, ArrayList. When to use which? I think array is static container, but collection is dynamic container. The drawback of array...
7
by: Marc Bishop | last post by:
Hi can anyone help? I'm making a shopping cart and am stuck on removing an item from my array? The array is made : cArray(ITEM_NAME,cItem) = ProductName
10
by: dfetrow410 | last post by:
Is there an example of how to store and access an array in a Property Dave
1
by: Luke Matuszewski | last post by:
Hej everybody. I am writing a lot of code in JavaScript, and my code begins too look to complicated... My work would be more effective is i could somehow emulate Sets, Lists and Maps especially...
2
by: wlevine | last post by:
Can someone give me an example of how to construct an array of objects? for example, I have: function objFacility(id,name,adr,city,state,zip) { this.id = id this.name=name this.adr=adr...
8
by: fniles | last post by:
I have a collection inside a class, sometimes when I add to the collection, I get the error "At least one object must implement IComparable". What does the error mean ? Thanks. Public Class...
1
by: cwertman | last post by:
I have an app that I have several functions I need to determine if a given propety is a a type of Collection It could (and in most cases is) a Generic Collection It could be , and array , an...
6
by: Venkatesh Bhupathi | last post by:
Hi All, I am trying to inherit the Generic IList<Tinterface to form the typed collection of objects of type T. Following is my sample code, Public Class Record { public string name;...
0
by: coolsti | last post by:
To the more experienced C# programmers, how do I do this best? I have a 2 dimensional mapping of values in a database, which represent a somewhat round (but not exactly round) shape when drawn out...
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: 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.