Md Tahmidul Abedin
Write the name of the three ways to pass a parameter to a method in C#.
By Md Tahmidul Abedin in C# on Oct 22 2018
  • Md Tahmidul Abedin
    Oct, 2018 22

    1. Value Parameters 2. Reference Parameters 3. Output Parameters

    • 8
  • Munib Butt
    Apr, 2020 28

    Value, Reference and Output parameters

    • 2
  • Madan Shekar
    Nov, 2018 5

    Value Parameters copies the actual value of an argument into the formal parameter of the function. When a simple variable is passed as the parameter to any method, it is passed as a value. This means that the value contained by the variable that is passed as the parameter is copied to the variables of the method, and if inside the method these values are changed or modified, the change is not reflected in the actual passed variable. Most of the primitive data types such as integer, double, Boolean etc. are passed by value.Reference ParametersReference Parameters copies the reference to the memory location of an argument into the formal parameter. Normally, all the objects are passed by reference as parameter to the method. The method operates on the references of the variables passed in the parameters rather than operating on their values. This results in the modification of variables in the calling function when they are modified in the called function. This means that changes made to the parameter affect the argument.Output ParametersOutput Parameters helps in returning more than one value . A return statement can be used for returning only one value from a function. However, using output parameters, you can return two values from a function. The variable supplied for the output parameter need not be assigned a value. Output parameters are particularly useful when you need to return values from a method through the parameters without assigning an initial value to the parameter. Output parameters are similar to reference parameters, except that they transfer data out of the method rather than into it

    • 1
  • Firoz Ahmad
    Dec, 2019 13

    Parameters can be passed to a method in following three ways :

    Value Parameters
    Reference Parameters
    Output Parameters

    • 0
  • Bidyasagar Mishra
    Aug, 2019 4

    value,out,ref

    • 0
  • Harisankar Angamuthu
    Nov, 2018 12

    1. We can pass Argument as parameter to Constructor, Method and by setting as a property. Method will get all three 1. Value Parameters 2. Reference Parameters 3. Output Parameters

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS