Im not a beginner in vb.net, but I never asked myself what is the difference
between folowing lines of code:
1.)You add a object to an array/arraylist/collection (lets take arraylists)
myArrayList.add (myobject)
Question: what is the difference if you handle myobject form myArrayList
like this :
a)ctype(myArray List(0),object) .value = something (directly from array
list)
or like this
b)object.value = something
I hope you understand what Im trying to ask, what is the difference if you
handle a object that is stored in a arrayList direct a array (probably using
Ctype), or that you handle it directly after you add it to array (in both
cases).
Thanks 1 1232
If I understand you correctly...
An arraylist is merely a collection of objects. It's a convenient way to
hold things, but it's simply a collection. However, you can shove all sorts
of things in the collection. If you CType it for instance, you can ensure
that a specific type is the only thing entered into your arraylist.
Consequently, you can Ctype it and access it's members.
I suspect you don't have Option Strict on, which you'll want to turn on and
you'll see the difference.
HTH,
Bill
"jg" <ph*****@obmocj e51.net> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl... Im not a beginner in vb.net, but I never asked myself what is the
difference between folowing lines of code:
1.)You add a object to an array/arraylist/collection (lets take
arraylists) myArrayList.add (myobject)
Question: what is the difference if you handle myobject form myArrayList like this :
a)ctype(myArray List(0),object) .value = something (directly from array list)
or like this
b)object.value = something
I hope you understand what Im trying to ask, what is the difference if you handle a object that is stored in a arrayList direct a array (probably
using Ctype), or that you handle it directly after you add it to array (in both cases).
Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gomaw Beoyr |
last post by:
Hello
Is there any explanation why Microsoft chose to implement
arrays as objects allocated on the heap instead of structs
allocated on the stack?
For "mathematical stuff", one normally wishes to avoid
unnecessary garbage collection, but that is exactly what's
going to happen if a lot of arrays, matrixes etc are allocated
on the heap.
|
by: Troy |
last post by:
Hello,
I have a dumb question. I have two array objects of type double with 12
elements in each object. I'd like to add the two objects but dont know how
to. Any ideas?
thanks
|
by: shuisheng |
last post by:
Dear All,
Assume I have a class named Obj.
class Obj
{ };
And a class named Shape which is derived from Obj.
class Shape: public Obj
|
by: 12jumper |
last post by:
Hi All :)
I've created an UserControl, which has a couple of properties that are
collections (generic lists of some objects). It would be nice, if
control refreshed each time I add a new item to the collection (using
StringCollectionEditor). Is there any attribute I can use, or perhaps I
have to create a new class that inherites from List<Tand subscribe on
some event? Any suggestions greatly appreciated.
Greetings
|
by: Kevin |
last post by:
I'm missing a basic understanding of how .net stores objects in a
collection. For example, I have an object called "dog", and I would
like to create and populate a List<of these.
For example:.
dog poodle =new dog("small", "white", 1);
dog shepherd =new dog("big", "brown", 2);
dog lab =new dog("medium", "black",3);
List<dogallDogs=new List<dog>();
| |
by: =?utf-8?B?TWFjaWVqIEJsaXppxYRza2k=?= |
last post by:
Hi Pythonistas!
I've got a question about storing tuples in a dictionary. First, a
small test case which creates a list of dictionaries:
import time
list_of_dicts =
keys =
prev_clk = time.clock()
|
by: walterbyrd |
last post by:
Python seems to have a log of ways to do collections of arbitrary
objects: lists, tuples, dictionaries. But what if I want a collection
of non-arbitrary objects? A list of records, or something like that?
|
by: =?Utf-8?B?TWlrZQ==?= |
last post by:
Checking whether an item exists in a collection before adding it ... (Key is
always a string and in this case is the value as well)
As Net has a Contains method ... is the following a safe alternative to the
VB6 On Error Resume Next?
If Not colDs.Contains(sKey) Then
colIDs.Add(sKey, sKey)
End If
|
by: tonytech08 |
last post by:
How valuable is it that class objects behave like built-in types? I
appears that the whole "constructor doesn't return a value because
they are called by the compiler" thing is to enable built-in-like
behavior for objects of class type. That leads to the "necessity" for
the exception machinery so that errors from constructors can be
handled. Is all that complexity worth it just to get built-in-like
behavior from class objects? Maybe a...
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |