using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace The parameters of the function
{
class Program
{
static void mm(ref int x, ref int y)
{
Console.WriteLine(" Passing in functions mm The parameters for :x = {0},y = {1}", x, y);
// The following three sentences are ： Exchange the values of two parameters
int temp = x;
x = y;
y = temp;
Console.WriteLine(" Executing functions mm After the output of the parameter value is ：x = {0},y = {1}", x, y);
}
static void Main(string[] args)
{
int i = , j = ;
Console.WriteLine(" stay Main Call in method mm The function passes in two arguments :i = {0},j = {1}", i, j);
mm(ref i, ref j);
Console.WriteLine(" stay Main After the execution of mm After the function ：i = {0},j = {1}", i, j);
}
}
}

## C# I quote （ref keyword ） More articles on parameters

1. Use C# Medium ref keyword , use 2 Here is a simple example to illustrate

stay C# in , If you prefix the method parameter with ref keyword , Indicates that the parameter passes a reference , It's not worth it . How to understand that ? Parameters are examples of simple types static void Main(string[] args) { string te ...

2. C++ in , Reference as function parameter

Reference as function parameter C++ The reason for adding reference types , It's mainly a function parameter , The function of transferring data by extension function . ———————————————————— c++, Function arguments :(1) Take the variable name as an argument and a formal parameter . And then it's passed to the formal parameter ...

3. How to use java Language implementation C# Medium ref keyword ( Pass parameters by reference ) The effect of

https://www.cnblogs.com/nnngu/p/8300164.html

4. python Parameters in function （ Key parameters , Default parameters , Positional arguments , Indefinite length parameter ）

Default parameters : When defining a function, give the variable a default value . def num(age=1): Positional arguments : When calling a function, it is referenced according to the formal parameter position and actual parameter position when defining the function . Key parameters : If the defined function contains keyword parameters , Call function ...

5. ref The role of keywords

ref Keyword to pass parameters by reference . The effect is , When control is passed back to the calling method , Any changes made to the parameters in the method will be reflected in the variable . That is to say , Use... In the parameters of the calling method ref Keywords enable variables to change . ref and out All are ...

6. C# Passing values and references ( ref out in )

A variable of a reference type does not directly contain its data : It contains references to its data . When passing a parameter of a reference type by value , It is possible to change the data that the reference points to , Such as the value of a class member ( Change the value of the property ), But you can't change the value of the reference itself : in other words , You can't use the same citation ...

7. C# Three keywords in params,Ref,out

About these three keywords before you can study some of the original operation using System; using System.Collections.Generic; using System.Text; namespace ...

8. C# Three keywords in params,Ref,out

One . using System; using System.Collection.Generic; using System.Text; namespace ParamsRefOut { class ...

9. C# in ref The knowledge and understanding of key words

When I took over the old project before, I encountered some method parameters used in ref Keyword is added before the parameter of parameter passing . For novice , Here is an introduction to ref The usage and practical effect of . CLR By default, the parameter passing method of all methods in is value passing , That is to say, no matter what you say ...

10. c# Medium ref、out、params Parameters

out Parameters And c++ A comparison of quotations from out Parameters can be used to pass method return values , And c++ It's a little bit like , But there are some differences : - When you call a method, you must write out Parameters - You must allocate space before calling a method - You don't need to ...

## Random recommendation

1. PHP mcrypt Summary of encryption extension usage

In development , Most of the time, we need to encrypt some sensitive data in the front-end and back-end interaction .PHP Some of them provide mcrypt Such an encryption extension of realizes the encryption and decryption of data . One .mcrypt Extended installation In the lower version of PHP In the configuration file ...

2. iOS Get information about operators

3. Analog circuit &quot; Deficiency &quot; &amp; &quot; Virtual break &quot;

< Deficiency & Virtual break > Operational amplifiers make up a variety of circuits , It's dazzling , Is the key point of learning in analog circuit . Look at all the books and courses on Analog Electronics , When introducing the operational amplifier circuit , It's just a qualitative analysis of the circuit , Like this ...

4. maven Write the main code and test code

3.2 Write the main code The project main code is different from the test code , The main code of the project will be packaged into the final component ( such as jar), The test code is only used when running tests , Will not be packed . By default ,Maven Suppose the project main code is located in src/main/ja ...

5. LaTeX Error: Something&#39;s wrong--perhaps a missing \item

Use Latex  References are cited ,.bib Files are a great assistant , After creation 1. The first step is to click Latex compile , You can get *.aux file .*.dvi file .*.log Files and *.gz file : 2. Step 2 Click Bibtex compile ...

6. Liferay7 BPM Portal development 23: Learn about built-in workflow （Kaleo Workflow）

Liferay The built-in workflow is a feature of the enterprise version , Simple as it is , But the community version is still not supported . Since we need to use more powerful Activiti To replace it , So it's very necessary to learn some ideas of built-in workflow , In order to learn from . Its characteristics : Workflow operation of entity ...

7. OpenGL Common drawing commands and effects in （ Experience setting ）

1. Culling polygon surfaces In 3D space , A polygon has two faces , But we can't see the polygons on the back , And some polygons are positive , But obscured by other polygons . If you treat invisible polygons as visible polygons , No doubt it will lower our ...

8. Linux——bash Application skills, simple learning notes

I saw it lamp Brother company video , Learning knowledge is simple , If there are any mistakes, please make bricks . Command-Line Completion Command completion allows the user to enter several words from the beginning of the file name Maternal queen , Press <Tab> Key to complete the file name . Command history Command history allows users to browse ...

9. MVC Customize With the expression tree as a parameter htmlhelper

public static MvcHtmlString Try<TModel, TProperty>( this HtmlHelper<TModel> htmlHelper, ...

10. Schema validation found non-datatype errors

Private Sub UpdateClaim(ByVal Status As String, ByVal Request As String) '======================' Im ...