Click here to Skip to main content
15,902,276 members
Home / Discussions / C#
   

C#

 
GeneralRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx7-Jun-17 6:33
professionaljkirkerx7-Jun-17 6:33 
QuestionCreate a chart in PowerPoint using C#. Pin
Member 126813284-Jun-17 22:30
Member 126813284-Jun-17 22:30 
AnswerRe: Create a chart in PowerPoint using C#. Pin
OriginalGriff4-Jun-17 22:43
mveOriginalGriff4-Jun-17 22:43 
Questioncustom controls not binding wpf Pin
Member 112967764-Jun-17 7:52
Member 112967764-Jun-17 7:52 
AnswerRe: custom controls not binding wpf Pin
Gerry Schmitz5-Jun-17 5:36
mveGerry Schmitz5-Jun-17 5:36 
GeneralRe: custom controls not binding wpf Pin
Member 112967765-Jun-17 18:30
Member 112967765-Jun-17 18:30 
QuestionConfigure Remote Machine's IP in C# Service At Install Time Pin
Django_Untaken3-Jun-17 22:58
Django_Untaken3-Jun-17 22:58 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Eddy Vluggen4-Jun-17 2:55
professionalEddy Vluggen4-Jun-17 2:55 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Gerry Schmitz4-Jun-17 4:45
mveGerry Schmitz4-Jun-17 4:45 
QuestionReport cant be display on report viewer page in c#.net windows form Pin
Member 132383512-Jun-17 22:31
Member 132383512-Jun-17 22:31 
AnswerRe: Report cant be display on report viewer page in c#.net windows form Pin
User 41802543-Jun-17 3:32
User 41802543-Jun-17 3:32 
QuestionHow to solve 2 js script file crash problem Pin
Member 130563031-Jun-17 16:22
Member 130563031-Jun-17 16:22 
AnswerRe: How to solve 2 js script file crash problem PinPopular
Gerry Schmitz1-Jun-17 16:47
mveGerry Schmitz1-Jun-17 16:47 
GeneralRe: How to solve 2 js script file crash problem Pin
OriginalGriff1-Jun-17 20:25
mveOriginalGriff1-Jun-17 20:25 
AnswerRe: How to solve 2 js script file crash problem Pin
Pete O'Hanlon1-Jun-17 21:49
mvePete O'Hanlon1-Jun-17 21:49 
Questiondatagrid view to pdf by iTextsharp Pin
Member 130230281-Jun-17 9:07
Member 130230281-Jun-17 9:07 
AnswerRe: datagrid view to pdf by iTextsharp Pin
Afzaal Ahmad Zeeshan1-Jun-17 10:46
professionalAfzaal Ahmad Zeeshan1-Jun-17 10:46 
AnswerRe: datagrid view to pdf by iTextsharp Pin
Gerry Schmitz1-Jun-17 16:46
mveGerry Schmitz1-Jun-17 16:46 
QuestionHow can i effectively write the code for calling a function before and after execution of every function in a class. Pin
yeswanthkumar30-May-17 2:51
yeswanthkumar30-May-17 2:51 
AnswerRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
Pete O'Hanlon30-May-17 3:11
mvePete O'Hanlon30-May-17 3:11 
AnswerRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
Gerry Schmitz30-May-17 12:41
mveGerry Schmitz30-May-17 12:41 
AnswerRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
BillWoodruff1-Jun-17 6:06
professionalBillWoodruff1-Jun-17 6:06 
GeneralRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
yeswanthkumar1-Jun-17 20:31
yeswanthkumar1-Jun-17 20:31 
GeneralRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
BillWoodruff2-Jun-17 6:07
professionalBillWoodruff2-Jun-17 6:07 
QuestionUsing A Generic Class with a Type Constraint Pin
Richard Andrew x6429-May-17 9:24
professionalRichard Andrew x6429-May-17 9:24 
OK, here's a real mind-twister. I can't figure out how to declare the parameter of a function as deriving from a generic class.

Here's the code:
C#
public class BusinessObjectBase
{
}

public class BusinessObjectList<T> : List<T> where T : BusinessObjectBase
{}

public class BusinessObjectDataSet : DataSet
{
    protected BusinessObjectList<BusinessObjectBase>[] _BusinessObjectListArray = null;

    public virtual void AddBusinessObjectList(BusinessObjectList<BusinessObjectBase> List)
    {

    }


}

I want to specify the variable as type BusinessObjectList<T> where T derives from BusinessObjectBase.

The code above compiles fine, but when I go to use the classes, that's the problem:
C#
private class MyBusinessObject : BusinessObjectBase
{
    public MyBusinessObject()
    {

    }
}

private class MyBusinessObjectList<MyBusinessObject> : BusinessObjectList<T> where T : BusinessObjectBase
{

}


 BusinessObjectDataSet Set = new BusinessObjectDataSet();

 MyBusinessObject Bo = new MyBusinessObject();                                                 // Derives from BusinessObjectBase

 MyBusinessObjectList<MyBusinessObject> BoList = new MyBusinessObjectList<MyBusinessObject>(); // Derives from BusinessObjectList<T>

 Set.AddBusinessObjectList(BoList);  // Here it says "Error CS1503  Argument 1: cannot convert from 'MyBusinessObjectList<MyBusinessObject>' to 'BusinessObjectList<BusinessObjectBase>'

What am I doing wrong?

Thank you for taking the time to grok this.

EDIT: Fixed an omission in the code. Revised the question that I'm asking.



The difficult we do right away...
...the impossible takes slightly longer.


modified 29-May-17 16:14pm.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.