大会中的课程顺序 [英] Order of Classes within an Assembly

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

问题描述

有什么方法可以改变它吗?

And.. is there a way to change it?

附加信息:您可以通过反思自己检查排序,或者您可以使用像ILDASM这样的工具,禁用按字母顺序排序,然后您还将获得订单。

Additional info: you can check the ordering either through reflection yourself, or you can use a tool like ILDASM, disable the alphabetical sorting, and then you will also get the order.

订单似乎是由编译器确定的奇怪方式。

Order seems to be in a strange way determined by the compiler.

我已经尝试过一些事情。如同重命名类(顺序保持不变),也编辑.csproj文件以更改.cs文件的顺序。

I already tried some things.. like renaming the classes (order stays the same), also editing the .csproj file to change the order of the .cs files.

我的主要焦点是VS2008, ,.net 3.5。

My main focus is VS2008, C#, .net 3.5.

更新:我有一个场景,反射) - 我需要特殊的秩序。

Update: I do have a scenario where the order matters (external program going through my assembly through reflection) - and I need special order there. Apart from this - you are totally right - order really should not matter.

推荐答案

我会坚持下去我的颈部在这里,并说这是一个实现细节,可能由任何特定的编译器决定。

I'm going to stick my neck out here and say this is an implementation detail and may well be decided by any particular compiler.

由于这是一个实现细节不应该或不需要关注。当然,如果这真的很重要(看不到为什么),你总是可以写自己的IL。

Since this is an implementation detail you shouldn't or needn't be concerned. Of course if this really is important (can't see why) you can always write your own IL.

我给你留下从 Eric的博客 a>:


编译相同的C#程序两次保证产生相同的
二进制输出?

Is compiling the same C# program twice guaranteed to produce the same binary output?

否。

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

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