سؤال

I have subjected error. Why this error is comming, even I used same thing for my other classes.

ActCtrl ctrl = new ActCtrl();
Act action = ctrl.GetAct(companyID, actionID);

And in Act class.

public Act GetAct(string companyID, string actionID)
{
    return (new ActBO()).GetAct(companyID, actionID);
}

And in BO class

public Act GetAct(string companyID, string actionID)
{
return (new ActDAO()).GetAct(companyID, actionID);
}

It gives me Cannot implicitly convert type 'Ent.Act' to 'ERP.Actions.Act' error on

Act action = ctrl.GetAct(companyID, actionID);

Any idea please. Thanks.

هل كانت مفيدة؟

المحلول

You've got two different Act classes - one in the Ent namespace, and one in ERP.Actions.Act.

Your action variable is of type ERP.Actions.Act, but ctrl.GetAct is returning an Ent.Act reference.

It's not clear what these classes are meant to be, but you may well want to try to collapse them to one class - or at least rename one of them for clarity.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top