Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
Questionprint button to print a control Pin
student19888-May-09 10:42
student19888-May-09 10:42 
AnswerRe: print button to print a control Pin
fly9048-May-09 10:47
fly9048-May-09 10:47 
GeneralRe: print button to print a control Pin
student19888-May-09 11:03
student19888-May-09 11:03 
GeneralRe: print button to print a control Pin
fly9048-May-09 11:11
fly9048-May-09 11:11 
Questionautomatic byte conversion? Pin
terradtc8-May-09 10:39
terradtc8-May-09 10:39 
AnswerRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 12:06
sitebuilderLuc Pattyn8-May-09 12:06 
GeneralRe: automatic byte conversion? Pin
terradtc8-May-09 12:31
terradtc8-May-09 12:31 
GeneralRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 12:44
sitebuilderLuc Pattyn8-May-09 12:44 
That is a lot of questions.

1. speed
Smaller variables typically don't get processed any faster or slower. Modern CPUs are capable of dealing with them very well. And storing the lowest byte or short of an integer is exactly the same as storing a byte or short, i.e. there are instructions that deal with the lower part of a register.

2. memory cost
For single variables, the size is not really important. It only becomes important when you have a lot of them, as in large arrays. In general an array takes a number of bytes equal to the number of elements times the size (in bytes) of a single element. So int[12] is four times larger than byte[12].

Conclusion: don't bother choosing byte/short/int until it becomes relevant, e.g. because:
- you want the overflow to occur (a value that should wrap from 255 to 0 can best be a byte)
- you want to preserve memory (as in images that may hold thousands or millions of pixels)

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: automatic byte conversion? Pin
terradtc8-May-09 13:05
terradtc8-May-09 13:05 
GeneralRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 13:25
sitebuilderLuc Pattyn8-May-09 13:25 
Questionreading pixel's value in an image Pin
wasifmuneer8-May-09 8:53
wasifmuneer8-May-09 8:53 
AnswerRe: reading pixel's value in an image Pin
molesworth8-May-09 9:05
molesworth8-May-09 9:05 
GeneralRe: reading pixel's value in an image Pin
Dan Neely8-May-09 9:27
Dan Neely8-May-09 9:27 
AnswerRe: reading pixel's value in an image Pin
Dave Kreskowiak8-May-09 9:14
mveDave Kreskowiak8-May-09 9:14 
AnswerRe: reading pixel's value in an image Pin
terradtc8-May-09 10:50
terradtc8-May-09 10:50 
GeneralRe: reading pixel's value in an image Pin
wasifmuneer8-May-09 12:28
wasifmuneer8-May-09 12:28 
GeneralRe: reading pixel's value in an image Pin
Christian Graus8-May-09 14:53
protectorChristian Graus8-May-09 14:53 
GeneralRe: reading pixel's value in an image [modified] Pin
terradtc9-May-09 0:40
terradtc9-May-09 0:40 
Questionmsgbox show for a set time Pin
Sokka938-May-09 8:48
Sokka938-May-09 8:48 
AnswerRe: msgbox show for a set time Pin
Dave Kreskowiak8-May-09 9:00
mveDave Kreskowiak8-May-09 9:00 
AnswerRe: msgbox show for a set time Pin
Ravi Bhavnani8-May-09 11:31
professionalRavi Bhavnani8-May-09 11:31 
AnswerRe: msgbox show for a set time Pin
Atif Shahbaz8-May-09 21:05
Atif Shahbaz8-May-09 21:05 
AnswerRe: msgbox show for a set time Pin
Rajdeep.NET is BACK8-May-09 21:32
Rajdeep.NET is BACK8-May-09 21:32 
GeneralRe: msgbox show for a set time Pin
Sokka938-May-09 22:43
Sokka938-May-09 22:43 
QuestionSearching randomly Pin
Rajdeep.NET is BACK8-May-09 8:39
Rajdeep.NET is BACK8-May-09 8:39 

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.