开发者

multiple classes calling a method in a class in another file

Le开发者_如何学Ct's say I created a method that is in a partial class in App_Code. This method would replace the same type of method that would otherwise be in many files.

Since it would be called from many files, it would probably be called and used very frequently especially because of this.

Would this overload this class? I'm not saying what would most likely happen, I'm just asking if it would be even remotely possible?


If I didn't misunderstand your question: A method doesn't care how often it is called.

However, you should care if the method takes long to return (ie. extensive work on the database which takes an abnormal amount of time).


On compilation, the compiler combine different partial classes on the basis of same name into one class. so if there is a difference in signature of method, but with same name, it is allowed and is method overloading. Otherwise the compile will throw error if it found same function(same function means same name and signature).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜