Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
GeneralRe: GetProcAddress and P/Invoke Pin
Mike_V21-May-03 3:01
Mike_V21-May-03 3:01 
GeneralWho can tell me how to use "event & delegate" Pin
llk9881116unicorn18-May-03 3:23
llk9881116unicorn18-May-03 3:23 
GeneralRe: Who can tell me how to use "event & delegate" Pin
leppie18-May-03 6:38
leppie18-May-03 6:38 
QuestionSort a DataTable?? Pin
Roger Alsing17-May-03 12:19
Roger Alsing17-May-03 12:19 
Generaladding more slots to an array after initialization... Pin
Anonymous17-May-03 8:57
Anonymous17-May-03 8:57 
GeneralRe: adding more slots to an array after initialization... Pin
leppie17-May-03 9:32
leppie17-May-03 9:32 
GeneralRe: adding more slots to an array after initialization... Pin
Anonymous17-May-03 10:45
Anonymous17-May-03 10:45 
GeneralRe: adding more slots to an array after initialization... Pin
Wesner Moise17-May-03 18:40
Wesner Moise17-May-03 18:40 
leppie wrote:
static Array Resize(Array src, int newsize){ Array dest = Array.CreateInstance(src.GetValue(0).GetType(), newsize); Array.Copy(src, dest, (src.Length < newsize ? src.Length : newsize)); return dest;}

The code has problems if
1) the first value is null
2) if array is an array of interfaces or abstract classes
(for example, the most common type of array, object[], can't be resized by this method)
3) if first value represents an derived class, rather than the appropriate base class

Correction: Use src.GetType().GetElementType() rather than src.GetValue(0).GetType()

Thanks,
Wes
GeneralRe: adding more slots to an array after initialization... Pin
leppie17-May-03 23:37
leppie17-May-03 23:37 
GeneralRe: adding more slots to an array after initialization... Pin
leppie17-May-03 23:41
leppie17-May-03 23:41 
GeneralRe: adding more slots to an array after initialization... Pin
Wesner Moise18-May-03 8:47
Wesner Moise18-May-03 8:47 
GeneralRegionData format Pin
Wizard_0117-May-03 6:50
Wizard_0117-May-03 6:50 
GeneralRe: RegionData format Pin
Nick Parker17-May-03 7:38
protectorNick Parker17-May-03 7:38 
QuestionHow to save a bitmap Pin
PrebKlok16-May-03 20:32
PrebKlok16-May-03 20:32 
AnswerRe: How to save a bitmap Pin
apferreira16-May-03 21:42
apferreira16-May-03 21:42 
GeneralRe: How to save a bitmap Pin
PrebKlok16-May-03 22:03
PrebKlok16-May-03 22:03 
GeneralRe: How to save a bitmap Pin
Nick Seng19-May-03 0:04
Nick Seng19-May-03 0:04 
GeneralRe: How to save a bitmap Pin
PrebKlok19-May-03 0:15
PrebKlok19-May-03 0:15 
GeneralRich Text Box Pin
Anonymous16-May-03 15:46
Anonymous16-May-03 15:46 
GeneralRe: Rich Text Box Pin
KingTermite17-May-03 6:24
KingTermite17-May-03 6:24 
Generalavi codec information Pin
cbiacca16-May-03 14:25
cbiacca16-May-03 14:25 
GeneralRe: avi codec information Pin
The Limey16-May-03 18:13
The Limey16-May-03 18:13 
GeneralRe: avi codec information Pin
J. Dunlap16-May-03 18:29
J. Dunlap16-May-03 18:29 
GeneralRe: avi codec information Pin
The Limey16-May-03 20:20
The Limey16-May-03 20:20 
GeneralRe: avi codec information Pin
leppie16-May-03 22:39
leppie16-May-03 22: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.