A: 

Try this. The method needs to be a generic, TEntity is simply the placeholder for the type.

public static void DeleleAllObjects<TEntity>( this ObjectSet<TEntity> objectSet,
                                              IEnumerable<TEntity> objects)
    where TEntity : class
{

   foreach(var o in objects)
   {
      objectSet.DeleteObject(o);
   }
}
tvanfosson
Thank tvanfosson for your suggestion. I've tried it and got the same error. The type 'TEntity' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method 'System.Data.Objects.ObjectSet<TEntity>'
embarus
You need a class constraint on the type parameter.
Craig Stuntz
@embarus -- @Craig is right. I omitted the generic constraint. I've updated.
tvanfosson
Thank you very much, tvanfosson. This help me a lot. :)
embarus
@embarus -- glad to be of help. Since you're new I thought I'd let you know that the way the system works is that you vote up (using the arrows next to the answer score) answers that are helpful and accept (using the check mark) the answer that solves your problem. The more you use the system the better off you'll be if you use the voting mechanisms to reward those who help you.
tvanfosson