John Baird
Coatesville, Pennsylvania, United States
General information
Category:
Object Oriented Programming
Environment versions
Network:
Windows 2003 Server
>>>>OK, I'm sure it is. It just seems to me that if they are showing you how to use pointers in C# they are either showing off or haven't completely made the paradigm shift from C/C++ to C#. You can usually make things work the way they used to if you're determined enough.
>>>
>>>Check the book and that particular chapter before jumping to conclusions.
>>
>>
>>What conclusions? Its the same as someone moving to .net and still using fox's hungarian notation or the toolkit so you can use foxpro command words and write in a style that no other .net programmer would understand. I restate again, if you need unsafe code or pointers in c#, then you haven't thought out your design well enough or you have chosen the wrong language to implement it. I've been using c# since late 2002 and have never had to write pointer notation in c#. Just because its in a book somewhere, doesn't make it right or reasonable.
>
>I took this book out from the library today again. Here is what chapter 11 says:
>
>This section looks at one of the main areas in which pointers can be useful: creating high performance, low-overhead arrays on the stack. Although C# makes it very easy to use both 1-dimensional and rectangular or jagged multidimensional arrays, it suffers from the disadvantage that these arrays are actually objects; they are instances of System.Array. This means that the arrays are stored on the heap with all of the overhead that this involves....
>
>etc., I don't want to re-type what this book says, but I believe you should check this chapter first before making any general statements...
Again, and I'm sorry I can't type slow enough for you to keep up. What need to you have to use stack-based arrays? With the new generics I don't use any of the old arrays, hashtables, etc, anymore and neither do most of the developers I know who keep up with current technology. Just because something is possible in a language, it is not a reason to try and use it if better methods exist. I have a friend who is trying to simulate multiple inheritance in c# by using partial classes and interfaces. I asked him to give me one valid example of why. He couldn't. Same with you. Why do you want to use a stack based array? I can't wait to hear the answer.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only