Managed C# and Unsafe Code
From: CodeTyro (CodeTyro_at_discussions.microsoft.com)
Date: 01/16/05
- Next message: james: "Re: NotifyIcon Problem"
- Previous message: Joe: "Look for a really good Charting package"
- Next in thread: Niki Estner: "Re: Managed C# and Unsafe Code"
- Reply: Niki Estner: "Re: Managed C# and Unsafe Code"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 16 Jan 2005 08:49:04 -0800
My native language being C++, I've got a few questions that a couple of hours
of searching on msdn didn't answer.
First, when using unsafe code and pointers, what is the C# equivalent to the
C++ "delete" command? I would like to keep my memoryspace clean, but I've
been unable to find a way to do it thus far.
Second, I'm using structs to store a specific set of data. Is there a C#
equivalent to the C++ STL "Vector" (or any of the STLs)? I read about sorted
lists, queues, and the like, though they seem to be only strings. Is there a
way to modify the type?
Third, and most important, I've got a bit of code that uses a large number
of pointers. There are six classes, five derived classes from one base. The
base is the only one with pointers ("Base_ *next", for the obvious linked
list structure). The "base" class for the other functions is an "unsafe
public class", but when iI try to call a pointer to this class in a function
within another class (alsoe "unsafe public class") it gives me an error,
"error CS0208: Cannot take the address or size of a variable of a managed
type ('NPCGen.Base_')" I'm at a loss, expecting it to be unmanaged as I
specified "unsafe". How do I set functions to be unmanaged?
-- Code - Specifically C++ & C# Tyro - Novice Apprentice
- Next message: james: "Re: NotifyIcon Problem"
- Previous message: Joe: "Look for a really good Charting package"
- Next in thread: Niki Estner: "Re: Managed C# and Unsafe Code"
- Reply: Niki Estner: "Re: Managed C# and Unsafe Code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|