Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of C#
  • Discussion

  • Study Guides

  • Table of Contents

Bookmark and Share
Lecture Comments (1)

0 answers

Post by Kitt Parker on May 11, 2015

Good Morning,

I have done a lot of training in C++, looking through C-Sharp now.  I noticed you included keyword ref in method call.  I noticed also that this is required.  When I remove the ref keyword from the method call, the program errors.  This is different from c++ in that once defined, I did not need the reference symbol in the function call.  I assume this was forced to increase readability?  I do not need to look at the definition to know its by reference.  Otherwise it seems redundant.  

Helper Methods

  • Functions return a value, Subs do not
  • By value is the default way to pass values
  • By reference passes the value itself to the function or sub
    • use (ref [variable]) to pass by reference
  • Use a Return Value to know if a call was successful or not
  • Unsuccessful calls get an error code as the Return Value, successful calls usually return a 0 (zero)
  • Overloading calls allow you to use the same method name for a different parameter list
  • You can “stack” function calls, where the return value of one function is used as the input parameters of another