Click here to Skip to main content
15,940,173 members
Home / Discussions / C#
   

C#

 
AnswerRe: Have I Gone Nuts? Pin
Heath Stewart2-Jan-04 10:50
protectorHeath Stewart2-Jan-04 10:50 
GeneralRe: Have I Gone Nuts? Pin
eggie52-Jan-04 14:11
eggie52-Jan-04 14:11 
GeneralRe: Have I Gone Nuts? Pin
Heath Stewart2-Jan-04 19:34
protectorHeath Stewart2-Jan-04 19:34 
GeneralRe: Have I Gone Nuts? Pin
eggie52-Jan-04 21:07
eggie52-Jan-04 21:07 
Generalchat Pin
keeper_corp2-Jan-04 10:07
keeper_corp2-Jan-04 10:07 
GeneralRe: chat(Modified) Pin
Mazdak2-Jan-04 10:10
Mazdak2-Jan-04 10:10 
QuestionValue collections? Pin
Judah Gabriel Himango2-Jan-04 10:00
sponsorJudah Gabriel Himango2-Jan-04 10:00 
AnswerRe: Value collections? Pin
Heath Stewart2-Jan-04 10:14
protectorHeath Stewart2-Jan-04 10:14 
Not in the BCL, not until .NET 2.0 when they will be introducing generics in .NET.

For now, you can implement something yourself. Almost all collection-like classes in .NET use an ArrayList because it can grow but it does take an Object which requires boxing value types. ArrayList uses arrays internally, and creates new arrays when necessary and copies elements to the new array. Do the same yourself, but using the value types that you need to collect. Methods like Array.CopyTo make copying elements to the new array easy, and of course creating a new array that's large enough isn't hard. For example, ArrayList.Capacity is the initial capacity (size of the array). When more elements need to be stored, Capacity is doubled and a new array of that size is created. Elements are copied and the old array is disposed (if necessary). You wouldn't have to double, though, it just what the BCL does. You could implement more predictive algorithms if you need to.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Value collections? Pin
Judah Gabriel Himango2-Jan-04 11:02
sponsorJudah Gabriel Himango2-Jan-04 11:02 
Generalresponding to keydown event while my form is inactive Pin
amgad_fathy2-Jan-04 8:21
amgad_fathy2-Jan-04 8:21 
GeneralRe: responding to keydown event while my form is inactive Pin
Mazdak2-Jan-04 8:34
Mazdak2-Jan-04 8:34 
GeneralRe: responding to keydown event while my form is inactive Pin
Heath Stewart2-Jan-04 9:22
protectorHeath Stewart2-Jan-04 9:22 
GeneralRe: responding to keydown event while my form is inactive Pin
Mazdak2-Jan-04 10:07
Mazdak2-Jan-04 10:07 
GeneralPrinting in Different paper size Pin
IntegraSoft2-Jan-04 8:20
IntegraSoft2-Jan-04 8:20 
GeneralRe: Printing in Different paper size Pin
eggie52-Jan-04 8:26
eggie52-Jan-04 8:26 
GeneralRe: Printing in Different paper size Pin
IntegraSoft2-Jan-04 8:33
IntegraSoft2-Jan-04 8:33 
GeneralRe: Printing in Different paper size Pin
eggie52-Jan-04 8:39
eggie52-Jan-04 8:39 
GeneralRe: Printing in Different paper size Pin
Mazdak2-Jan-04 8:42
Mazdak2-Jan-04 8:42 
GeneralRe: Printing in Different paper size Pin
Heath Stewart2-Jan-04 9:18
protectorHeath Stewart2-Jan-04 9:18 
GeneralRe: Printing in Different paper size Pin
IntegraSoft2-Jan-04 9:25
IntegraSoft2-Jan-04 9:25 
GeneralRe: Printing in Different paper size Pin
Heath Stewart2-Jan-04 9:31
protectorHeath Stewart2-Jan-04 9:31 
GeneralRe: Printing in Different paper size Pin
IntegraSoft2-Jan-04 9:47
IntegraSoft2-Jan-04 9:47 
GeneralRe: Printing in Different paper size Pin
Heath Stewart2-Jan-04 10:08
protectorHeath Stewart2-Jan-04 10:08 
GeneralRe: Printing in Different paper size Pin
IntegraSoft2-Jan-04 10:18
IntegraSoft2-Jan-04 10:18 
GeneralRe: Printing in Different paper size Pin
Heath Stewart2-Jan-04 10:31
protectorHeath Stewart2-Jan-04 10:31 

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.