Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
AnswerRe: Retrieve the value of Inout parameter Pin
Luis Alonso Ramos25-Aug-05 17:19
Luis Alonso Ramos25-Aug-05 17:19 
GeneralRe: Retrieve the value of Inout parameter Pin
tsramkumar26-Aug-05 1:35
tsramkumar26-Aug-05 1:35 
Questionxs:date type in DataSet Pin
tadass25-Aug-05 11:10
tadass25-Aug-05 11:10 
QuestionUsing ArrayList Pin
MarkMokris25-Aug-05 10:49
MarkMokris25-Aug-05 10:49 
AnswerRe: Using ArrayList Pin
gnjunge25-Aug-05 10:54
gnjunge25-Aug-05 10:54 
GeneralRe: Using ArrayList Pin
Daniel132425-Aug-05 13:33
Daniel132425-Aug-05 13:33 
AnswerRe: Using ArrayList Pin
Matt Gerrans25-Aug-05 16:59
Matt Gerrans25-Aug-05 16:59 
AnswerRe: Using ArrayList Pin
Luis Alonso Ramos25-Aug-05 17:12
Luis Alonso Ramos25-Aug-05 17:12 
It depends on what types of objects you are inserting in the ArrayList. If you are inserting reference types (basically any object) there's a very slight, almost negligible, performance penalty in casting to and from object.

On the other hand, if you insert value types (ints, doubles, DateTimes and so on) in the ArrayList, the performance penalty is big because when you put a value type in an object variable, the compiler has to create a dummy object to contain the value and insert a reference to that object (a process called boxing). When you cast an object to a value type (when getting an item from the ArrayList for example) the process is called unboxing and is the exact opposite: go get the object and take the value from inside it.

An advantage of using specialized collections derived from CollectionBase is that the compiler does type checking for you. You usually can't assign an object to a typed variable without casting, but the other way around is not true: you can assign a variable of any type to a object variable. With a specialized collection, you can't add items of other types without the compiler complaining.

-- LuisR





Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!


The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

-- modified at 23:13 Thursday 25th August, 2005
GeneralRe: Using ArrayList Pin
Kevin McFarlane26-Aug-05 0:33
Kevin McFarlane26-Aug-05 0:33 
AnswerRe: Using ArrayList Pin
radic.feng26-Aug-05 1:23
radic.feng26-Aug-05 1:23 
QuestionJob Scheduler Pin
mohitTheOne25-Aug-05 9:46
mohitTheOne25-Aug-05 9:46 
AnswerRe: Job Scheduler Pin
miah alom25-Aug-05 11:45
miah alom25-Aug-05 11:45 
QuestionSubclassing in .NET Pin
Luis Alonso Ramos25-Aug-05 9:43
Luis Alonso Ramos25-Aug-05 9:43 
AnswerRe: Subclassing in .NET Pin
Daniel Turini25-Aug-05 10:31
Daniel Turini25-Aug-05 10:31 
GeneralRe: Subclassing in .NET Pin
Luis Alonso Ramos25-Aug-05 16:59
Luis Alonso Ramos25-Aug-05 16:59 
Answer[Message Deleted] Pin
miah alom25-Aug-05 11:59
miah alom25-Aug-05 11:59 
QuestionSetting the exact position of a tooltip Pin
Luis Alonso Ramos25-Aug-05 9:37
Luis Alonso Ramos25-Aug-05 9:37 
AnswerRe: Setting the exact position of a tooltip Pin
miah alom25-Aug-05 12:00
miah alom25-Aug-05 12:00 
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos25-Aug-05 16:47
Luis Alonso Ramos25-Aug-05 16:47 
GeneralRe: Setting the exact position of a tooltip Pin
miah alom26-Aug-05 11:03
miah alom26-Aug-05 11:03 
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos26-Aug-05 16:31
Luis Alonso Ramos26-Aug-05 16:31 
GeneralRe: Setting the exact position of a tooltip Pin
Alomgir Miah26-Aug-05 17:31
Alomgir Miah26-Aug-05 17:31 
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos26-Aug-05 22:08
Luis Alonso Ramos26-Aug-05 22:08 
QuestionPlease could you... Pin
KORCARI25-Aug-05 9:26
KORCARI25-Aug-05 9:26 
AnswerRe: Please could you... Pin
miah alom25-Aug-05 12:03
miah alom25-Aug-05 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.