C#将行与先前的行比较 [英] C# Compare Rows with Previous Ones

查看:73
本文介绍了C#将行与先前的行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想将数据表的单元格值与之前的单元格值进行比较,并显示相似数据的单元格值。可以使用嵌套的for循环来完成它,但它的复杂性是O(n ^ 3)。有没有更好的方法呢?



例如

ON =对象名称

A#=属性

ON -A1-A2-A3-A4

A --- 2 --- 3 --- 2 --- 1

B --- 1 --- 3 --- 3 --- 2

C --- 2 --- 1 --- 1 --- 1

D --- 3 --- 2 --- 2 --- 1



结果是

答:0

BA:A2

CA:A1-A4

CB:0

DA:A3-A4

DB:0

DC:A4

感谢您的帮助。

Hello, I want to compare cell values of a datatable with the previous ones and display attribute number of the similar ones. It is possible to do it using nested for-loops but its complexity is O(n^3). Is there a better way to do it?

For example
ON = Object Name
A# = Attribute
ON-A1-A2-A3-A4
A---2---3---2---1
B---1---3---3---2
C---2---1---1---1
D---3---2---2---1

Here the result is
A : 0
B-A: A2
C-A: A1-A4
C-B: 0
D-A: A3-A4
D-B: 0
D-C: A4
Thanks for the help.

推荐答案

只需逐个获取值并轻松完成任务只是思考并做到这一点
just fetch one by one value and do it its easy task just think and do it


这篇关于C#将行与先前的行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆