LINQ query into ObservableCollection?
<p><a href="https://stackoverflow.com/questions/1465285/cast-linq-result-to-observablecollection">Cast LINQ result to ObservableCollection</a></p>

<p>Jon Skeet give a great answer in the question ,but I still cannot make my own.</p>

<p>Still new to <a href="https://msdn.microsoft.com/en-us/library/x9afc042.aspx" rel="nofollow noreferrer">classes</a>, so I am still in the learning phases with them.</p>

<p>I have made a LINQ to SQL class and obviously there is a lot of auto generated code. This is the a snippet of the class generated when adding the class, that is relevant to this question. This is obviously linked to the DataBase Table named <code>Staff_Time_TBL</code>.</p>

<pre><code>public partial class Staff_Time_TBL : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private long _ID;

        private System.Nullable&lt;System.DateTime&gt; _Date_Data;
    }
</code></pre>

<p>I have a working class that I made that gets the data I need into the Datagrid,
It pulls data from between two dates and from a Staff Member with a unique staff number. This works fine, but when updating data dirrectly to the database, the data in the interface is not updated ,<a href="https://stackoverflow.com/questions/38223793/refresh-wpf-datagrid-not-bound-to-observable-collection">see this question.</a></p>

<pre><code>internal class DatabaseQueries
    {
        public static IEnumerable&lt;Staff_Time_TBL&gt; MainTable(DatabaseDataContext database, DateTime fromDate, DateTime toDate, int employeeNumber)
        {
            return database.Staff_Time_TBLs.Where(staff =&gt;
                staff.Date_Data &gt; fromDate &amp;&amp;
                staff.Date_Data &lt; toDate &amp;&amp;
                staff.Staff_No == employeeNumber);
        }
</code></pre>

<p><a href="https://stackoverflow.com/a/1465307/6283475">This code in this answer</a> is understandable, but I have no idea what <code>foo</code> would need to be?</p>

<pre><code>var linqResults = foos.Where(f =&gt; f.Name == "Widget");

var observable = new ObservableCollection&lt;Foo&gt;(linqResults);
</code></pre>

<p>How can I make an Observablecollection Class to hold the LINQ query?</p>

<p>This is what I tried to do something, but gives me a compile error at the query.</p>

<blockquote>
  <p>Cannot implicitly convert type
  'System.Collections.Generic.List' to
  'System.Collections.ObjectModel.ObservableCollection'</p>
</blockquote>

<pre><code>public ObservableCollection&lt;Staff_Time_TBL&gt; observerableInfoData { get; set; }

        public MainWindow()
        {  
            DataContext = this; // required for C# binding
            InitializeComponent();            

                            observerableInfoData = new ObservableCollection&lt;Staff_Time_TBL&gt;();
                observerableInfoData = sql.Staff_Time_TBLs.Where(staff =&gt; staff.Staff_No == SelectedEmployee.Key &amp;&amp;
                                               staff.Date_Data == filterFrom &amp;&amp;
                                               staff.Date_Data == filterTo).Select(staff =&gt; staff.Info_Data).ToList();
</code></pre>