AddNewCore error

AddNewCore error

Old forum URL: forums.lhotka.net/forums/t/7220.aspx


lgroup posted on Thursday, July 02, 2009

I've created a very simple EditableRootListBase class following examples I've seen, but when I attempt to compile I get the following error in the AddNewCore method:

'Biz.Providers.AddNewCore()': return type must be 'object' to match overridden member 'System.ComponentModel.BindingList.AddNewCore()'

My methods is defined as:

protected override void AddNewCore()
{
var child = Provider.NewProvider();
Add(child);
}


Why would I be getting this error when the demo code I've seen is defined the same way? Why do the examples return void instead of the new object?


Thanks,
John

RockfordLhotka replied on Thursday, July 02, 2009

The method signature is different in .NET and Silverlight.

In Silverlight the method is void. In .NET the method returns type object.

Also the implementation is different. In Silverlight the implementation is async, and in .NET the implementation is sync.

My guess is that you are doing Silverlight, and just need to put this code into your .client.cs file or use a compiler directive so it only compiles on the SL side.

lgroup replied on Thursday, July 02, 2009

Ah ha!! I was taking my examples from your video demo code (006) for Silverlight, but my code is not for a Silverlight app.

Thanks Rocky!

By they way, I think it would be great if you were to add a video or two targeted towards those of us still in the Windows/Web forms world. The videos have been hugely beneficial!! :-)

RockfordLhotka replied on Thursday, July 02, 2009

Thank you for the feedback on the videos. Several people have told me how valuable these are, and I am seriously considering putting together videos for CSLA .NET for Windows in the very near future.

Copyright (c) Marimer LLC