列表 第页
我有以下的(简称为清楚起见) - 一个枚举,与枚举的基类,和两个派生类设置枚举一个特定的值I have the following (abbreviated for clarity) - an enum, a base class with that enum, and two derived classes tha...阅读全文
让我们说我有:public abstract ServiceBase : RoleEntryPoint {...}public MyRealService : RoleEntryPoint {...}将我的Azure WorkerRole项目能够正确地计算出的 MyRealService 的类作为WorkerRo...阅读全文
在C#中,我想实现我可以使用数据绑定到我传递给它(控制从databoundcontrol对象派生前提当然)任何控制In c# I am trying to implement a method which I can use to bind data to any control I pass to it (prov...阅读全文
这是应用具体的例子来说明我的眼前的问题:An application specific example to illustrate my immediate problem:我有一个元数据提供程序类具有以下(有删节)接口:I have a metadata provider class with the foll...阅读全文
我想了解CLR如何分派方法调用正确当一个对象隐藏了基类成员时,对象引用存储在一个基类的变量。I am trying to understand how CLR dispatches method call correctly when an object hides base class member when...阅读全文
采用最新的2.0测试版ProtoBuf.net的版本我想序列化派生类(只是举例),我得到空文件。为什么基类的属性不是序列?[ProtoContract][可序列化]公共类Web2PdfClient:Web2PdfEntity{}[ProtoContract][可序列化]公共类Web2PdfEntity:Eng...阅读全文
考虑如下的继承层次结构:A/ B1 B2/C|D用C++实现如下:class A {public:A() {};virtual ~A() = 0;double a;};A::~A() {};class B1 : virtual public A {public:B1() {}virtual ~B1() {}...阅读全文
我有基类的BaseClass 和派生类 DerivedA , DerivedB 和 DerivedC 所有继承的BaseClass 。I have base class BaseClass and derived classes DerivedA, DerivedB, and DerivedC that all in...阅读全文
我有以下类的结构:public abstract class PresenterBase{public static Dictionary methodsList;public void Bind()public void Initialize();}public clas...阅读全文
public interface ITest{int ChildCount { get; set; }}public class Test{}public class OrderPool : ITest, Test{public int ChildCount{get;set;}}错误说Base类测试必须来自...阅读全文
我正在对派生类进行单元测试,希望EXPECT_CALL调用属于其基类的某个方法。例如:class Base {public:void move(int x, int y);};class Derived: public Base{public:RESULT update();private:int age;};...阅读全文
是否可以强制执行派生类需要实现一个构造函数(带参数)? 编译时合同我有一个构造函数需要一个参数的基类:公共类FooBase{保护int值;公共FooBase(int值){THIS.VALUE =价值; }公共虚拟无效的doSomething(){抛出新的NotImplementedException(); }}我...阅读全文
我一直是一个净codeR(不能说我是一个程序员)2年。有一个问题,我无法理解多年,这是怎么可能的基类的一个实例持有派生类的一个实例?I have been a .Net coder (can not say I am a programmer) for 2 years. There is one question t...阅读全文
我使用的BaseClass和code期待客户ID为int类型的遗产code。然后,我有一个要求,以创建一个新的类,DerivedClass,其行为非常像BaseClass的,但现在客户ID必须是一个字符串。遗留code不能被修改,使得测试是不需要的。 我如何得到我想要使用继承(或任何其他方式)的影响?下面Linqpad...阅读全文
这是一个随访对这一问题:Lambda EX pression没有返回预期的MemberInfo This is a followup to this question: Lambda expression not returning expected MemberInfoclass Human{public s...阅读全文
比方说,我们有这样的code部分:Let's say we have a code portion like this:IProduct product = ProductCreator.CreateProduct(); //Factory method we have hereSellThisProduct(p...阅读全文
public interface IBasePresenter{}public interface IJobViewPresenter : IBasePresenter{}public interface IActivityViewPresenter : IBasePresenter{}public c...阅读全文
为什么要在C#中是不允许的派生类具有比其基类更高的可访问性。Why in C# it is not allowed for derived classes to have greater accessibility than its base class.例如这会给错误:可访问性不一致:基类BaseClass的比类...阅读全文
我实现Web API 2服务使用JSON.NET进行序列化。 I'm implementing a Web API 2 service that uses JSON.NET for serialization. 当我试图把(deseralize)更新JSON数据,该抽象类并非present这意味着它不知道如何处理...阅读全文
Class A { }Class B : A { }B ItemB = new B();A ItemA = (A)B;Console.WriteLine(ItemA.GetType().FullName);是否有可能做这样的事情上面,并让编译器打印出A型,而不是B型基本上是有可能永久对象转换,因此失去的所有导出数据...阅读全文