473,883 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ArrayList without Boxing and UnBoxing

How can I create an ArrayList in the older version of .NET that does not require
the expensive Boxing and UnBoxing operations?

In my case it will be an ArrayList of structures of ordinal types.

Thanks.
Nov 3 '06
94 5724

"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
>
Peter Olcott wrote:
>It looks like you have found the best possible solution to every aspect of my
original question. I am assuming that generics are equivalent to C++
templates
so that this solution could be adapted to become a generic solution. I am
assuming by what you said that C# does not have the equivalent the [inline]
keyword.

After all of this back-and-forth about array access speed....

You DO realize that C# is a garbage-collected language, like Java, and
that at any time the GC can decide to kick in and do garbage
collection?

I know that people DO use C# for real-time applications, so you may
want to read up on how they ensure that particular paths through the
code (which are the paths with real-time deadlines to meet) aren't
interrupted by the GC.
I would think that this might be something like forcing GC before you enter the
time critical path? I don't think that GC will be a problem for my most time
critical operation. For this operation I know the required size in advance for
the operation requiring the largest amount of memory, and the other operations
need so little memory that I could allocate the maximum required of this memory
in advance too, if I have to.

I will implement the original solution in unmanaged C++. Because of all of the
help that I have received here it looks like I will be able to transform this
original solution into a .NET implementation. In other words the .NET
architecture has passed the required feasibility tests. It looks like .NET can
provide the required performance, one way or another.

Also I just went back and reviewed, the help that you provided was apparently
the most useful of all help that was provided, thanks again.
Nov 24 '06 #91
Willy... I must very dense. I thought the OP was trying to write in
managed code
using patterns that he was familiar with such as the STL. I was trying
to point
out that his knowledge base in STL is still valuable and that this
knowledge can
be utilized in writing managed code if uses managed STL.

Regards,
Jeff
>But, std::vector is a STL container, not a managed STL (now officially
named
STL/CLR) container, and these were available since VC6.<

*** Sent via Developersdex http://www.developersdex.com ***
Nov 24 '06 #92

"Jeff Louie" <an*******@devd ex.comwrote in message
news:ur******** ******@TK2MSFTN GP03.phx.gbl...
Willy... I must very dense. I thought the OP was trying to write in
managed code
using patterns that he was familiar with such as the STL. I was trying
to point
out that his knowledge base in STL is still valuable and that this
knowledge can
be utilized in writing managed code if uses managed STL.
That info was very useful too, thanks. I might do it that way with STL.
>
Regards,
Jeff
>>But, std::vector is a STL container, not a managed STL (now officially
named
STL/CLR) container, and these were available since VC6.<

*** Sent via Developersdex http://www.developersdex.com ***

Nov 24 '06 #93
"Jeff Louie" <an*******@devd ex.comwrote in message
news:ur******** ******@TK2MSFTN GP03.phx.gbl...
Willy... I must very dense. I thought the OP was trying to write in
managed code
using patterns that he was familiar with such as the STL. I was trying
to point
out that his knowledge base in STL is still valuable and that this
knowledge can
be utilized in writing managed code if uses managed STL.

Regards,
Jeff
>>But, std::vector is a STL container, not a managed STL (now officially
named
STL/CLR) container, and these were available since VC6.<

*** Sent via Developersdex http://www.developersdex.com ***
Jeff,
I don't see a reason to be dense, in your reply to Arne:
Just to be clear, I believe std::vector is finally available in
C++/CLI.

I noticed the "finally", and that's why I said that std:vector is a native STL container,
which is available in all versions of VC++ since VC6. Don't know why you did use *finally*
here, really.

Willy.

Nov 24 '06 #94
Huh. OK. You are right. I am wrong.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 24 '06 #95

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

Similar topics

5
7870
by: Kevin | last post by:
Hi All Can someone please tell me the difference between an Array and an ArrayList, and where I would be likely to use one over the other Thanks alot for any help
18
3262
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point storage and dynamically resize it when there is a new point or should I use ArrayList? Is speed noticable between the two? Regards,
48
4504
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a lot faster with both methods using .NET 1.1, that's why I am pretty sure its a (rather serious) bug. Below you can find C# test case that should allow you to reproduce this error, to run it you will need to put 2 data files into current directory...
19
13748
by: ahjiang | last post by:
hi there,, what is the real advantage of boxing and unboxing operations in csharp? tried looking ard the internet but couldnt find any articles on it. appreciate any help
161
7913
by: Peter Olcott | last post by:
According to Troelsen in "C# and the .NET Platform" "Boxing can be formally defined as the process of explicitly converting a value type into a corresponding reference type." I think that my biggest problem with this process is that the terms "value type" and "reference type" mean something entirely different than what they mean on every other platform in every other language. Normally a value type is the actual data itself stored in...
12
9803
by: Justin | last post by:
Ok, I give up. I can't seem to construct a decent (productive) way of sorting my arraylist. I have a structure of two elements: Structure TabStructure Dim TabName As String Dim FullFilePath As String End Structure
0
9933
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9781
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
11118
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10836
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,...
0
10407
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9564
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7960
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
7114
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();...
2
4209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.