Click here to Skip to main content
15,911,035 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do I play audio files in vb.net Pin
Wun'nam28-Nov-07 7:05
Wun'nam28-Nov-07 7:05 
AnswerRe: How do I play audio files in vb.net Pin
Paul Conrad28-Nov-07 12:36
professionalPaul Conrad28-Nov-07 12:36 
Questionprint local rdlc report without showing Pin
Gulfraz Khan28-Nov-07 6:39
Gulfraz Khan28-Nov-07 6:39 
Questioncode for scanning and saving from my application Pin
er_niraj28-Nov-07 3:57
er_niraj28-Nov-07 3:57 
GeneralRe: code for scanning and saving from my application Pin
SekharOne6-Dec-07 22:53
SekharOne6-Dec-07 22:53 
QuestionEnumeration Question Pin
imonfiredammit28-Nov-07 3:52
imonfiredammit28-Nov-07 3:52 
AnswerRe: Enumeration Question Pin
Colin Angus Mackay28-Nov-07 4:06
Colin Angus Mackay28-Nov-07 4:06 
GeneralRe: Enumeration Question Pin
sgorozco28-Nov-07 16:41
sgorozco28-Nov-07 16:41 
Colin Angus Mackay wrote:
Enumerators are just objects, just like normal variables are objects.


Hi Colin, well, actually not all normal variables are objects. An integral type (Int16, Int32, etc.. ) is a value type, and it is not stored as an object (reference type) UNLESS it is needed to. It all depends on your code's syntax.

This automatic conversion between value types and reference types is managed transparently by the .net platform by means of two behind-the-scenes processes known as "boxing" and "unboxing" respectively.

Boxing implies first creating on the heap a new instance of an object "compatible" with the original value type (involving dynamic memory allocation) then the actual variable's value must be copied to this new instance.

Unboxing implies dereferencing the value stored in an object instance and convert it back to a value-type.

Dim o as Object
Dim n as Integer
Dim m as Integer
Dim al as New ArrayList

o = 5  ' the value 5 is converted to an object (boxing) before being assigned
n = 0  ' the object's value 5 is dereferenced and stored back in n as a type value (unboxing)
       ' This means that n holds a copy of the value stored in o (5) not an extra reference to the same object refered by o

m = 10 ' The value 10 is directly stored in variable m as a value type, no heap memory allocation has taken place

al.Add(m) ' The variable m is converted to an object (boxed) before being added to the collection


Some languages like C++ can't treat integral types as objects for the sake of efficiency, other languages like Smalltalk effectively treat every variable (even integral types) as objects, which results in memory allocation/deallocation overhead for every single variable. The .net platform gives you the best of both worlds: on most cases, integral variables will be treated as efficiently as C++'s integral variables, but if needed to, they will be *transparently* converted to an object by the automatic "boxing-unboxing" process, giving you the full benefits of object orientation.

Cheers,

Gerardo


An interesting form of object-oriented programming:
You suggest a novel algorithm, and watch as the rest of your team objects! Wink | ;)

AnswerRe: Enumeration Question Pin
sgorozco28-Nov-07 11:39
sgorozco28-Nov-07 11:39 
QuestionCode to ZIP Files in VB.NET Pin
sameer.pandurangi28-Nov-07 2:29
sameer.pandurangi28-Nov-07 2:29 
AnswerRe: Code to ZIP Files in VB.NET Pin
pmarfleet28-Nov-07 2:56
pmarfleet28-Nov-07 2:56 
AnswerRe: Code to ZIP Files in VB.NET Pin
DigiOz Multimedia28-Nov-07 5:46
DigiOz Multimedia28-Nov-07 5:46 
GeneralRe: Code to ZIP Files in VB.NET Pin
Paul Conrad28-Nov-07 12:37
professionalPaul Conrad28-Nov-07 12:37 
QuestionProblem with Listbox code Pin
soniasan28-Nov-07 2:12
soniasan28-Nov-07 2:12 
AnswerRe: Problem with Listbox code Pin
Dave Kreskowiak28-Nov-07 5:03
mveDave Kreskowiak28-Nov-07 5:03 
GeneralRe: Problem with Listbox code Pin
Paul Conrad28-Nov-07 12:38
professionalPaul Conrad28-Nov-07 12:38 
QuestionSending Mail through Crystal Report. Pin
KETAN K.28-Nov-07 1:33
KETAN K.28-Nov-07 1:33 
AnswerRe: Sending Mail through Crystal Report. Pin
Tom Deketelaere28-Nov-07 3:28
professionalTom Deketelaere28-Nov-07 3:28 
QuestionPop Up Pin
Aparna.B28-Nov-07 1:11
Aparna.B28-Nov-07 1:11 
AnswerRe: Pop Up Pin
Vimalsoft(Pty) Ltd28-Nov-07 2:10
professionalVimalsoft(Pty) Ltd28-Nov-07 2:10 
GeneralRe: Pop Up Pin
Tom Deketelaere28-Nov-07 3:37
professionalTom Deketelaere28-Nov-07 3:37 
AnswerRe: Pop Up Pin
Dave Kreskowiak28-Nov-07 4:54
mveDave Kreskowiak28-Nov-07 4:54 
GeneralRe: Pop Up Pin
Paul Conrad28-Nov-07 12:40
professionalPaul Conrad28-Nov-07 12:40 
AnswerRe: Pop Up Pin
Paul Conrad28-Nov-07 12:39
professionalPaul Conrad28-Nov-07 12:39 
Questionstill having probs listing Windows Explorer using Shell Pin
GuildfordG28-Nov-07 0:47
GuildfordG28-Nov-07 0:47 

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.