appcode文件夹如何工作 [英] how does the appcode folder work
问题描述
应用程序代码文件夹中的类是否会自动实例化。系统是否会自动查找默认构造函数?
前几天我在默认构造函数中调用了一些错误,但我从未实例化过该类。
我已经通过从默认构造函数中删除代码解决了这个问题。
任何帮助在清除我的困惑之后,我之前没有看过这个问题,因为通常我不把我的课程放在应用程序代码文件夹中,它们通常在Dll的
< blockquote>不,没有自动实例化 - 除非使用 new
关键字特别请求它们,否则不会创建任何实例( structs除外
,但是除非使用 new
,否则不调用它们的构造函数。
我怀疑您正在另一个类中创建实例,或者可能在另一个类的静态构造函数中创建实例。
Do classes in the app code folder automatically get instantiated. Does the system automatically look for a default constructor?
I got an error the other day for something that was being called in the default constructor, but i never instantiated the class.
I have since fixed this problem by removing the code from the default constructor.
Any help on clearing up my confusion, i've not seen this issue before as usually i don't put my classes in the app code folder, they're usually in Dll's
No, there is no "automatic instantiation" - no instances get created unless they are specifically requested with thenew
keyword (exceptstructs
, but their constructor isn't called unlessnew
is used).
I would suspect that you are creating an instance in a different class, or perhaps in a static constructor of a different class.
这篇关于appcode文件夹如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!