Ref, Out, and Pointers
TweetC# has a bunch of methods of passing variables to methods. The decision you need to make is based on how you are intending to use that variable. We will discuss Ref and Out. Both of these two methods are very similar except for moe gigantic difference!
We will also discuss the use of Pointers. As you recall from Programming in C, pointers are labels that are referencing memory space instead of the data contained in that memory space. In C, we did many examples of printing out pointers and the value of the memory where the pointer was referencing. Since C# falls in like with many of the values of C it actually allows pointers (eat your heart out Java). Keep in mind that pointers in C# is not considered good practice, however, they support them mainly for backwards compatibility with non .Net compiled API's.
| Attachments | Size |
|---|---|
program...ers.pdf | 868.8 KB |