Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
AnswerRe: C++ guy missing pointers Pin
V.15-Mar-06 21:52
professionalV.15-Mar-06 21:52 
GeneralRe: C++ guy missing pointers Pin
BadKarma15-Mar-06 21:59
BadKarma15-Mar-06 21:59 
GeneralRe: C++ guy missing pointers Pin
V.15-Mar-06 22:14
professionalV.15-Mar-06 22:14 
GeneralRe: C++ guy missing pointers Pin
BadKarma15-Mar-06 23:27
BadKarma15-Mar-06 23:27 
AnswerRe: C++ guy missing pointers Pin
J4amieC15-Mar-06 22:26
J4amieC15-Mar-06 22:26 
GeneralRe: C++ guy missing pointers Pin
BadKarma15-Mar-06 23:13
BadKarma15-Mar-06 23:13 
GeneralRe: C++ guy missing pointers Pin
J4amieC15-Mar-06 23:42
J4amieC15-Mar-06 23:42 
AnswerRe: C++ guy missing pointers Pin
mcljava17-Mar-06 5:03
mcljava17-Mar-06 5:03 
I know your pain, I was experience C/C++ withdrwals too. Here's my take: you don't need any pointers in managed safe code. In system code (i.e. unmanaged you can still use them). Now with that said most applications are more easily maintained and written if they leverage the C# managed classes.

You still have Ref and plus a new Qualifier call Out. But instead of operating on addresses, all C# logic is based on arrays and indices. So I could have an 100 item array of int called myList. If I call a funtion called AddTheValues it might look like this:

<br />
public long AddTheValues( int[] numbers )<br />
{<br />
    long total = 0;<br />
<br />
    //<br />
    // note we do not need an int* to operate on numbers<br />
    //<br />
    for ( int i=0; i < numbers.Length; ++i )<br />
        total += numbers[i];<br />
<br />
    return total;<br />
}<br />


Out is sort of like a built in malloc or new that a function returns thru the parameter list instead of as a return value. Good fpr special allocator type code.

<br />
public void NextValueList( out int[] num, int size )<br />
{<br />
    num = new int[size];<br />
}<br />



Ref is used when like in C++ we are concerned about operating the SAME structure. In C# you normally don'd have to clean up (i.e. free) new'd elements. This is true for the general case. BUT if you have hairy I/O classes then there is a destructor equiavlent called IDisposable. Basically you derive your C# class from this Interface and it provides the Dispose() method you can customize to clean up.

Good Luck



Mike Luster
CTI/IVR/Telephony SME
QuestionWhy is my inherited window forms control deleted Pin
Tony_Joh15-Mar-06 21:15
Tony_Joh15-Mar-06 21:15 
QuestionDataSet Problem Pin
Ali Zubairy15-Mar-06 18:58
Ali Zubairy15-Mar-06 18:58 
QuestionIP ADDRESS - Problem Pin
Jijo BP15-Mar-06 18:27
Jijo BP15-Mar-06 18:27 
AnswerRe: IP ADDRESS - Problem Pin
Guffa15-Mar-06 18:36
Guffa15-Mar-06 18:36 
GeneralRe: IP ADDRESS - Problem Pin
Jijo BP15-Mar-06 19:29
Jijo BP15-Mar-06 19:29 
QuestionHow to use IPersistStreamInit? Pin
zhaoyu16215-Mar-06 18:06
zhaoyu16215-Mar-06 18:06 
QuestionReg Nullable.Wrap function Pin
Kiran Kumar Singani15-Mar-06 17:39
Kiran Kumar Singani15-Mar-06 17:39 
QuestionCan not use RightClick/Past when i catch Keys in TextBox? Pin
superdragon15-Mar-06 17:23
superdragon15-Mar-06 17:23 
AnswerRe: Can not use RightClick/Past when i catch Keys in TextBox? Pin
superdragon15-Mar-06 19:21
superdragon15-Mar-06 19:21 
QuestionSearch function in Crystal Report Pin
angelagke15-Mar-06 15:33
angelagke15-Mar-06 15:33 
QuestionBar code component connect to computer? Pin
notIdea15-Mar-06 14:43
notIdea15-Mar-06 14:43 
AnswerRe: Bar code component connect to computer? Pin
mcljava15-Mar-06 18:21
mcljava15-Mar-06 18:21 
QuestionI’m a c++ guy and C#’s List scares me. Pin
Julien15-Mar-06 12:37
Julien15-Mar-06 12:37 
GeneralRe: I’m a c++ guy and C#’s List scares me. Pin
George L. Jackson15-Mar-06 17:54
George L. Jackson15-Mar-06 17:54 
GeneralRe: I’m a c++ guy and C#’s List scares me. Pin
Julien15-Mar-06 18:25
Julien15-Mar-06 18:25 
QuestionDatagrid help Pin
bazzanewt15-Mar-06 11:56
bazzanewt15-Mar-06 11:56 
AnswerRe: Datagrid help Pin
Robert Rohde15-Mar-06 18:28
Robert Rohde15-Mar-06 18:28 

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.