标签:write div int out struct static person mes ace
C#对类的解构,必须在该类内实现Deconstruct方法,并且返回类型为void ,并用out参数返回各个部分。
using System; using System.Text; namespace ConsoleApp1 { class Program { static void Main(string[] args) { (int c, int d) = new Person(); Console.WriteLine(c); Console.WriteLine(d); } } class Person { public void Deconstruct(out int a,out int b) { a = 122; b = 1; } } }
标签:write div int out struct static person mes ace
原文地址:https://www.cnblogs.com/mlh1421/p/11516872.html