Home

LinqPad 6 with System.Data.Linq.Table

I have the code below that works in Linqpad 5. How can I recreate this code in Linqpad 6?

The 'System.Data.Linq.Table' produces an error:

CS0234 The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

public static void SerializeToFile<T>(this System.Data.Linq.Table<T> source, string filename, Expression<Func<T, bool>> predicate = null) where T: class
    {
        var entities = ((predicate == null) ? source : source.Where(predicate)).ToList();

        var xSer = new XmlSerializer(typeof(List<T>));

        using (var wrt = new StreamWriter(filename))
        {
            xSer.Serialize(wrt, entities);
        }
    }

Any suggestions?

Thanks

Comments

Sign In or Register to comment.