FastMember列顺序保留 [英] FastMember column order preservation

查看:64
本文介绍了FastMember列顺序保留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用TypeAccessor.Create FastMember时,似乎总是以字母排序的顺序返回列的列表.是否可以告诉它保留类中列的顺序?

When using TypeAccessor.Create FastMember always seems to return a list of the columns in alphabetic sorted order. Is it possible to tell it to preserve the ordering of the columns in the class?

例如:

var testClass = new { B = "1", A = "2" };

将从GetMembers返回A列然后是B列,如果可能的话,我想让它保留B列然后是A的顺序.

will return column A then B from GetMembers, I'd like to get it to preserve the ordering of B then A if possible.

推荐答案

看起来Evk是正确的,并且它实际上不能通过标准API来完成.为了完整起见,我将其作为答案.

Looks like Evk is right and it can't really be done via the standard APIs. In the interest of completeness I'll leave this as the answer.

这篇关于FastMember列顺序保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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