I am trying to create a class that inherits from SPListItem. When I try to compile it throws the error:
The type
‘Microsoft.SharePoint.SPListItem’ has
no constructors defined
Here is my code:
public class MySPListItem : SPListItem
{
public string ItemUrl {get;set;}
}
Is there anyway I can inherit from SPListItem?
As svick has pointed out, the documentation states that there are no public or protected constructors which means you won’t be able to inherit from this class.
I do wonder though, if you’re inheriting so that you can extend this class, you might be best off writing some extension methods.
This might be a viable option if that’s what you’re intending to do, extend the class.