How can we improve the below line of code?
<p>Can we improve this line of code</p>

<pre><code>if ((l_Subscription.PackageInfo.Applications.Where(x =&gt; x.DeviceType != DeviceType.UnKnown)).Count() &gt; 0)
        {
            //l_Subscription.DeviceTypeID = ((l_Subscription.PackageInfo.Applications.Where(x =&gt; x.DeviceType == DeviceType.Tablet)).Count() &gt; 0)?()
            if ((l_Subscription.PackageInfo.Applications.Where(x =&gt; x.DeviceType == DeviceType.Tablet)).Count() &gt; 0)
                l_Subscription.DeviceTypeID = (int)DeviceType.Tablet;
            else if ((l_Subscription.PackageInfo.Applications.Where(x =&gt; x.DeviceType == DeviceType.Phone)).Count() &gt; 0)
                l_Subscription.DeviceTypeID = (int)DeviceType.Phone;
        }
</code></pre>

<p>I just tried with the below but not working...Need help</p>

<pre><code>int cnt =  DoOperation(l_Subscription.PackageInfo.Applications, x =&gt; x.DeviceType != DeviceType.UnKnown);
       if(cnt &gt; 0)
       {
           int cnt1 =  DoOperation(l_Subscription.PackageInfo.Applications, x =&gt; x.DeviceType == DeviceType.Tablet);
           int cnt2 =  DoOperation(l_Subscription.PackageInfo.Applications, x =&gt; x.DeviceType == DeviceType.Phone);

           if(cnt1 &gt; 0) l_Subscription.DeviceTypeID = (int)DeviceType.Tablet;
           else if (cnt2 &gt; 0) l_Subscription.DeviceTypeID = (int)DeviceType.Phone;           
       }

        private int DoOperation&lt;TKey&gt;(List&lt;l_Subscription.PackageInfo.Applications&gt; list, Func&lt;l_Subscription.PackageInfo.Applications, TKey&gt; predicate)
        {        
            int count = 0;
            count = list.Where(predicate).Count();
            return count;
        }
</code></pre>
