例如,我不想在 Initialize() 方法中运行代码,而是只想写一行,比如 somecode.run() 它会为我运行一切,允许我在不同的位置编写所有代码为了组织。
我希望代码像在那个地方一样,所以我可以访问私人等。
最好的方法是什么?
编辑以澄清:
这是一个例子
public class game
{
public void Initialize()
{
I want to run some code here but I don't want to write it here,
I want to write it in another file for the sake of organization,
and just reference it somehow here, but yet still be able to use the
privates as if it was in this spot
}
}