Click here to Skip to main content
15,918,596 members
Home / Discussions / C#
   

C#

 
Generalabout WebBrowser in mdi Pin
benzite30-Jun-03 15:02
benzite30-Jun-03 15:02 
GeneralListView Column Width Pin
.gonad30-Jun-03 14:33
.gonad30-Jun-03 14:33 
GeneralPrint a web page Pin
nahumtakum30-Jun-03 11:08
nahumtakum30-Jun-03 11:08 
QuestionTimer + Thread = what? Pin
RB@Emphasys30-Jun-03 7:43
RB@Emphasys30-Jun-03 7:43 
AnswerRe: Timer + Thread = what? Pin
J. Dunlap30-Jun-03 7:57
J. Dunlap30-Jun-03 7:57 
GeneralRe: C# Memmory allocation Pin
Nemanja Trifunovic30-Jun-03 6:38
Nemanja Trifunovic30-Jun-03 6:38 
GeneralRe: C# Memmory allocation Pin
leppie30-Jun-03 9:22
leppie30-Jun-03 9:22 
GeneralRe: C# Memory allocation Pin
Wesner Moise30-Jun-03 12:45
Wesner Moise30-Jun-03 12:45 
Structs and other valuetypes such as ints and the like are created on the stack, not on the heap.

Thus, the syntax

int x = new int();

is confusing, because it appears the integer is allocated on the heap when it isn't.

To allocate on the heap, it is necessary to use (object) new int(), to box the valuetype as a heap object. It really is just syntactical sugar.

Valuetype arrays are allocated on the heap, but that's because arrays themselves are objects. But unlike object arrays, valuetype arrays contain the values as inlined elements rather than references.

Managed C++ makes it clear by exposing 2 pointers int __box * and int * to differentiate between boxed valuetypes and the stack-based equivalents.

Valuetypes are faster to operate than objects, but passing valuetypes around can involve an expensive copy operation if the valuetype is large, and are not passed by reference.

You can make your program an order of magnitude using valuetypes, but only if the data type truly exhibits value semantics. On the down side, you do lose a lot of flexibility.


Thanks,
Wes



GeneralRe: C# Memmory allocation Pin
Nemanja Trifunovic30-Jun-03 12:54
Nemanja Trifunovic30-Jun-03 12:54 
GeneralRe: C# Memmory allocation Pin
leppie30-Jun-03 13:14
leppie30-Jun-03 13:14 
GeneralRe: C# Memmory allocation Pin
Kannan Kalyanaraman1-Jul-03 1:32
Kannan Kalyanaraman1-Jul-03 1:32 
GeneralC# Memmory allocation Pin
zhyluo200330-Jun-03 6:30
zhyluo200330-Jun-03 6:30 
GeneralMatlab Application Pin
Ahmed Diaa30-Jun-03 6:24
Ahmed Diaa30-Jun-03 6:24 
GeneralActive Directory Searching Pin
soloforce30-Jun-03 6:18
soloforce30-Jun-03 6:18 
QuestionHow to make Key Logger? Pin
aMIR_bILAL30-Jun-03 5:41
aMIR_bILAL30-Jun-03 5:41 
GeneralLinkedLabel in Datagrid Pin
Chris#30-Jun-03 4:47
Chris#30-Jun-03 4:47 
QuestionColoring listview items? Pin
BoozeBomb30-Jun-03 4:41
BoozeBomb30-Jun-03 4:41 
AnswerRe: Coloring listview items? Pin
Roland Bär30-Jun-03 4:58
Roland Bär30-Jun-03 4:58 
GeneralNeed help with Regex Pin
viperxp30-Jun-03 4:15
viperxp30-Jun-03 4:15 
GeneralRe: Need help with Regex Pin
leppie30-Jun-03 13:32
leppie30-Jun-03 13:32 
GeneralRe: Need help with Regex Pin
viperxp30-Jun-03 19:05
viperxp30-Jun-03 19:05 
GeneralRe: Need help with Regex Pin
1-Jul-03 5:22
suss1-Jul-03 5:22 
GeneralImage-Listbox Pin
jphuphilly30-Jun-03 4:13
jphuphilly30-Jun-03 4:13 
GeneralRe: Image-Listbox Pin
Manster30-Jun-03 9:03
Manster30-Jun-03 9:03 
GeneralRe: Image-Listbox Pin
jphuphilly30-Jun-03 11:08
jphuphilly30-Jun-03 11:08 

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.