C # Key knowledge detailed (1)

zhaozj2021-02-08  255

Guide: After Microsoft's .NET is launched, the article about C # has also emerged, as a Microsoft's important and Java counter-resistant language, C # has many advantages. This article will select a detailed introduction of important knowledge in C # languages.

Author: wkrain www.ASPCool.com frontier after the launch of Microsoft's .NET, related articles on C # also have emerged as an important Microsoft compete with JAVA language, C # has many advantages. This article will select important knowledge in C # languages, Chapter 1: Parameter 1.1 IN parameter C # species four parameters: General parameter IN parameter OUT parameter number list This chapter will introduce the three uses. In the C language you can pass the address (ie, inactive) or the Delphi language passes the data sorting by the VAR indicator to pass the address parameters, how do you do it in the C # language? "IN" keyword can help you. This keyword can pass the parameters to pass the value you want to return. Namespace testRefp {sale system; public class myclass {public static void reftest (Ref int IVAL1) {ival1 = 2;} public static void main () {INT i = 3; // Variable needs to initialize REFTEST (REF I); console .WriteLine (i);}}} must be noted that variables must be initialized first. RESULTS: 5 1.2 OUT parameters Do you want to return multiple values ​​at a time? This task is basically impossible to complete the task in the C language. "OUT" keyword in C # can help you complete it. This keyword can return multiple values ​​at a time by parameter. Public class mathclass {public static int testout (out INT IVAL1, OUT IVAL2) {ival1 = 10; IVAL2 = 20; Return 0;} public static void main () {INT I, J; // variable does not need to initialize. Console.Writeline (Testout (Out I, Out J); Console.WriteLine (i); console.writeLine (j);}} A single number of representatives, for example, the parameter number is the length of the variable. Using system; class test {static void f (params int [] args) {console.writeline ("# parameter: {0}", args.length); for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-2325.html

New Post(0)