当前位置:网站首页>C#函数返回多个值方法
C#函数返回多个值方法
2022-07-05 09:40:00 【小黄人软件】
方法一:直观
public (string gertec_code, string feitian_code,string part_name)getPartName(string feiTianCode)
{
if (feiTianCode.Equals("")) { return ("","",""); }
//用sn查csv获得其它数
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("错误 在物料Excel中找不到编号:" + feiTianCode);
return ("", "", "");
}
调用
//用sn查csv获得其它数
var v=getPartName(textBoxSN1.Text);
string feiTianCode = v.feitian_code;
string gertecCode = v.gertec_code;
string partName = v.part_name;
类似MFC中void getPartName(CString code ,CString &outcode)
方法2:所有值封装一个类,返回类对象。
方法3:全局变量
等等。
函数直接用代理
边栏推荐
- Implementation of smart home project
- 【小技巧】獲取matlab中cdfplot函數的x軸,y軸的數值
- 从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择
- [NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
- 解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
- Charm of code language
- The popularity of B2B2C continues to rise. What are the benefits of enterprises doing multi-user mall system?
- Node red series (29): use slider and chart nodes to realize double broken line time series diagram
- 天龙八部TLBB系列 - 关于技能冷却和攻击范围数量的问题
- Solve liquibase – waiting for changelog lock Cause database deadlock
猜你喜欢
How Windows bat script automatically executes sqlcipher command
从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择
观测云与 TDengine 达成深度合作,优化企业上云体验
Cut off 20% of Imagenet data volume, and the performance of the model will not decline! Meta Stanford et al. Proposed a new method, using knowledge distillation to slim down the data set
如何获取GC(垃圾回收器)的STW(暂停)时间?
Why does everyone want to do e-commerce? How much do you know about the advantages of online shopping malls?
移动端异构运算技术-GPU OpenCL编程(进阶篇)
基于模板配置的数据可视化平台
解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
随机推荐
天龙八部TLBB系列 - 单体技能群伤
MySQL数字类型学习笔记
Getting started with Apache dolphin scheduler (one article is enough)
Unity粒子特效系列-毒液喷射预制体做好了,unitypackage包直接用 - 上
MySQL字符类型学习笔记
卷起来,突破35岁焦虑,动画演示CPU记录函数调用过程
Fluent development: setting method of left and right alignment of child controls in row
Node red series (29): use slider and chart nodes to realize double broken line time series diagram
mysql80服务不启动
Tdengine can read and write through dataX, a data synchronization tool
Tutorial on building a framework for middle office business system
一种用于干式脑电图的高密度256通道电极帽
百度智能小程序巡檢調度方案演進之路
Common fault analysis and Countermeasures of using MySQL in go language
Android SQLite database encryption
About getfragmentmanager () and getchildfragmentmanager ()
Wechat applet - simple diet recommendation (4)
百度智能小程序巡检调度方案演进之路
Coordinate system of view
Comment obtenir le temps STW du GC (collecteur d'ordures)?