当前位置:网站首页>C function returns multiple value methods

C function returns multiple value methods

2022-07-05 10:14:00 Little yellow man software

Method 1 : intuitive  

    public (string gertec_code, string feitian_code,string part_name)getPartName(string feiTianCode)
        {
            if (feiTianCode.Equals("")) { return ("","",""); }
            // use sn check csv Get other numbers 
            int row = 0;
            for (row = 0; row < dt.Rows.Count; row++)
            {
                if (dt.Rows[row][0].ToString().Equals(feiTianCode) || dt.Rows[row][1].ToString().Equals(feiTianCode))
                {
                    return  (dt.Rows[row][0].ToString(), dt.Rows[row][1].ToString(), dt.Rows[row][2].ToString());
                }                         
            }
            Log(" error   In the material Excel No number found in :" + feiTianCode);
            return ("", "", "");
        }

call  

                // use sn check csv Get other numbers 
                var v=getPartName(textBoxSN1.Text);
                string feiTianCode = v.feitian_code;
                string gertecCode = v.gertec_code;
                string partName = v.part_name;

similar MFC in void getPartName(CString code ,CString &outcode)

Method 2: All values encapsulate a class , Return class object .

Method 3: Global variables

wait .

Function directly with proxy

原网站

版权声明
本文为[Little yellow man software]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050940092476.html