当前位置:网站首页>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:全局变量
等等。
函数直接用代理
边栏推荐
- The essence of persuasion is to remove obstacles
- Getting started with Apache dolphin scheduler (one article is enough)
- Implementation of smart home project
- 【OpenCV 例程200篇】219. 添加数字水印(盲水印)
- Mobile heterogeneous computing technology GPU OpenCL programming (Advanced)
- Single chip microcomputer principle and Interface Technology (esp8266/esp32) machine human draft
- Why don't you recommend using products like mongodb to replace time series databases?
- 解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
- 能源势动:电力行业的碳中和该如何实现?
- oracle和mysql批量Merge对比
猜你喜欢
正式上架!TDengine 插件入驻 Grafana 官网
tongweb设置gzip
Oracle combines multiple rows of data into one row of data
Three-level distribution is becoming more and more popular. How should businesses choose the appropriate three-level distribution system?
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
Unity粒子特效系列-毒液喷射预制体做好了,unitypackage包直接用 -下
[tips] get the x-axis and y-axis values of cdfplot function in MATLAB
Is it really reliable for AI to make complex decisions for enterprises? Participate in the live broadcast, Dr. Stanford to share his choice | qubit · viewpoint
H.265编码原理入门
Small program startup performance optimization practice
随机推荐
Common fault analysis and Countermeasures of using MySQL in go language
TDengine ×英特尔边缘洞见软件包 加速传统行业的数字化转型
oracle和mysql批量Merge对比
Community group buying has triggered heated discussion. How does this model work?
Charm of code language
硬核,你见过机器人玩“密室逃脱”吗?(附代码)
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
Solve liquibase – waiting for changelog lock Cause database deadlock
Generics, generic defects and application scenarios that 90% of people don't understand
从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择
View Slide
让AI替企业做复杂决策真的靠谱吗?参与直播,斯坦福博士来分享他的选择|量子位·视点...
From "chemist" to developer, from Oracle to tdengine, two important choices in my life
ArcGIS Pro 创建要素
Kotlin compose and native nesting
Roll up, break through 35 year old anxiety, and animate the CPU to record the function call process
【系统设计】指标监控和告警系统
Pagoda panel MySQL cannot be started
解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
Small program startup performance optimization practice