This is Sample of my Code
SPList list = new SPSite(siteURL).OpenWeb().Lists[listName]; SPEventReceiverDefinitionCollection eventReceivers = list.EventReceivers;
SPEventReceiverDefinition eventReceiver = eventReceivers.Add();
but when i use this code it returns error while Build Project and error is
Error 1 'Microsoft.SharePoint.SPEventReceiverDefinitionCollection' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'Microsoft.SharePoint.SPEventReceiverDefinitionCollection' could be found (are you missing a using directive or an assembly reference?)
The Error is in line eventReceivers.Add(); What Should I do now? can anybody help me Its Urgent.. Its a Sandboxed Solution..