Click here to Skip to main content
16,016,067 members
Home / Discussions / C#
   

C#

 
GeneralRe: Add-In VS .NET 2003 ToolTip on Words in Editor Pin
Anonymous21-Oct-04 7:48
Anonymous21-Oct-04 7:48 
Generalupdating a database Pin
steve_rm21-Oct-04 2:58
steve_rm21-Oct-04 2:58 
GeneralRe: updating a database Pin
Hugo Hallman21-Oct-04 3:03
Hugo Hallman21-Oct-04 3:03 
GeneralRe: updating a database Pin
Colin Angus Mackay21-Oct-04 3:11
Colin Angus Mackay21-Oct-04 3:11 
GeneralRe: updating a database Pin
steve_rm21-Oct-04 3:53
steve_rm21-Oct-04 3:53 
GeneralRe: updating a database Pin
Colin Angus Mackay21-Oct-04 5:02
Colin Angus Mackay21-Oct-04 5:02 
QuestionHigh performance buffer pooling? Pin
Hugo Hallman21-Oct-04 2:40
Hugo Hallman21-Oct-04 2:40 
AnswerRe: High performance buffer pooling? Pin
Heath Stewart21-Oct-04 7:41
protectorHeath Stewart21-Oct-04 7:41 
Better is a relative term. If "better" == "safer", then new byte[requiredSize] is better. If "better" == "faster", then you'll get better performance by P/Invoking HeapAlloc or similar. The problem with this approach is that the memory is unmanaged by the CLR so it can't track it. You could marshal it to an IntPtr and use that in managed code, but the buffer is still allocated on the unmanaged heap (or stack if you used something like _alloca). You'll have to free it explicitly. This is where wrapping such functions in a class following the disposable pattern is handle, and .NET 2.0 will introduce the SafeHandle for just such a purpose. You can either define your own now, or take a look at the GCHandle and HandleRef structs under System.Runtime.InteropServices which may be helpful depending on how you're using the memory (especially if you need to marshal managed types to native memory).

There is yet another way, though. Read about C#'s stackalloc operator keyword. This, of course, will alloc memory on the heap and give you an unsafe (i.e., has access to direct memory and is not GC'd) pointer.

HTH

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralScrollBar Problem Pin
ee9903521-Oct-04 2:07
ee9903521-Oct-04 2:07 
GeneralRe: ScrollBar Problem Pin
Heath Stewart21-Oct-04 7:26
protectorHeath Stewart21-Oct-04 7:26 
GeneralRe: ScrollBar Problem Pin
ee9903521-Oct-04 8:46
ee9903521-Oct-04 8:46 
GeneralRe: ScrollBar Problem Pin
Heath Stewart21-Oct-04 9:07
protectorHeath Stewart21-Oct-04 9:07 
GeneralChanging the Form icon Pin
Tony D. Abel21-Oct-04 2:03
Tony D. Abel21-Oct-04 2:03 
GeneralRe: Changing the Form icon Pin
perlmunger21-Oct-04 7:16
perlmunger21-Oct-04 7:16 
GeneralRe: Changing the Form icon Pin
Tony D. Abel22-Oct-04 5:36
Tony D. Abel22-Oct-04 5:36 
GeneralRegister Window Message Pin
ppp00121-Oct-04 1:42
ppp00121-Oct-04 1:42 
QuestionHow to find the window handle of MessageWindow instance of C# compact framework? Pin
ting66821-Oct-04 1:41
ting66821-Oct-04 1:41 
Generalcreate COM in c# Pin
ppp00121-Oct-04 1:32
ppp00121-Oct-04 1:32 
GeneralRe: create COM in c# Pin
perlmunger21-Oct-04 7:02
perlmunger21-Oct-04 7:02 
QuestionHow to convert a string to int ? Pin
Andres Coder21-Oct-04 0:39
Andres Coder21-Oct-04 0:39 
AnswerRe: How to convert a string to int ? Pin
Xiangyang Liu 刘向阳21-Oct-04 0:49
Xiangyang Liu 刘向阳21-Oct-04 0:49 
AnswerRe: How to convert a string to int ? Pin
Yuvaraj N21-Oct-04 1:00
Yuvaraj N21-Oct-04 1:00 
AnswerRe: How to convert a string to int ? Pin
J4amieC21-Oct-04 1:02
J4amieC21-Oct-04 1:02 
GeneralGetting Information about Windows Share Folders Pin
Yuvaraj N21-Oct-04 0:13
Yuvaraj N21-Oct-04 0:13 
GeneralMarshalling Inline Arrays Pin
David M. Kean20-Oct-04 22:42
David M. Kean20-Oct-04 22:42 

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.