什么是使用部分类,而不是一个抽象的好处? [英] What are the benefits to using a partial class as opposed to an abstract one?

查看:87
本文介绍了什么是使用部分类,而不是一个抽象的好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读编程微软的Visual C#®2008:语言,以更好地理解C#和什么可以用它来完成。我遇到了,我已经从ASP.Net的Page类中遇到的部分课程。

I have been reading Programming Microsoft® Visual C#® 2008: The Language to get a better understanding of C# and what can be done with it. I came across partial classes which I had already encountered from ASP.Net's Page class.

要我看来,你可以做局部类做一个抽象类和重写之一。显然,一支球队将是通过抽象方法的接口控制,但你会反正相互依托。而如果我们的目标是合作那么这不正是源控制和其他工具解决。

To me it seems that you can do what partial classes do with an abstract class and an overridden one. Obviously one team will be in control of the interface via the abstract methods but you would be relying on each other anyway. And if the goal is collaboration then isn't that what source control and other tools solve.

我只是缺少点的分部类。也可能有人提供了一个真实的世界中。

I am just missing the point to a partial class. Also could someone provide a real world use.

推荐答案

部分类都无关的对象继承。部分类只是一个分裂定义一个类为独立的文件(这是例如当你在Windows中创建一个新的形式完成的源代码的方式窗体应用程序 - 一个文件是你的代码,另一个文件了.Designer.cs包含VS2008为您管理的代码)。

Partial classes have nothing to do with object inheritance. Partial classes are just a way of splitting the source code that defines a class into separate files (this is for example done when you create a new form in your Windows Forms application - one file is "your" code, another file .designer.cs contains the code that VS2008 manages for you).

这篇关于什么是使用部分类,而不是一个抽象的好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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