Click here to Skip to main content
15,181,193 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# windows form & google api v3 Pin
mrx1003-May-12 8:39
Membermrx1003-May-12 8:39 
GeneralRe: c# windows form & google api v3 Pin
loyal ginger3-May-12 16:51
Memberloyal ginger3-May-12 16:51 
GeneralRe: c# windows form & google api v3 Pin
mrx1004-May-12 2:32
Membermrx1004-May-12 2:32 
GeneralRe: c# windows form & google api v3 Pin
loyal ginger4-May-12 3:32
Memberloyal ginger4-May-12 3:32 
GeneralRe: c# windows form & google api v3 Pin
mrx1007-May-12 2:50
Membermrx1007-May-12 2:50 
QuestionNeed help in writing code on establish a PPTP (VPN Tunnel) connection in c#. Pin
kalyan_vb2-May-12 1:14
Memberkalyan_vb2-May-12 1:14 
AnswerRe: Need help in writing code on establish a PPTP (VPN Tunnel) connection in c#. Pin
Richard MacCutchan2-May-12 3:41
mveRichard MacCutchan2-May-12 3:41 
QuestionRequesting for a snippet that can be used in LINQ to SQL query Pin
Nadia Monalisa1-May-12 21:48
MemberNadia Monalisa1-May-12 21:48 
Hi,

In my code, I am counting the number of records (sent emails) that are older than one month. In order to do that, I am using following snippet.

C#
int totalSentEmailsOlderThanMonth = emailSendingService.ListSentEmails().ToArray().Count(x => (DateTime.Now - x.SentDateTime).TotalDays > 30);


The reason I am using .ToArray() in my code as (DateTime.Now - x.SentDateTime).TotalDays cannot be translated in LINQ to SQL query so, by calling ToArray(), I am loading all records into the memory and then counting. But there are more than hundreds of records in my database and loading all the records into the memory just for counting is not efficient at all. So, would anyone please give me an alternative more efficient snippet that can be used in this scenario.

[[ By the way, emailSendingService.ListSentEmails() returns IQueryable<MyRecordType> ]]

Regards.
AnswerRe: Requesting for a snippet that can be used in LINQ to SQL query Pin
Keith Barrow2-May-12 3:23
professionalKeith Barrow2-May-12 3:23 
GeneralRe: Requesting for a snippet that can be used in LINQ to SQL query Pin
Nadia Monalisa2-May-12 5:32
MemberNadia Monalisa2-May-12 5:32 
QuestionSIFT Pin
ri19871-May-12 21:05
Memberri19871-May-12 21:05 
AnswerRe: SIFT Pin
AmbiguousName1-May-12 21:09
MemberAmbiguousName1-May-12 21:09 
AnswerRe: SIFT Pin
egenis1-May-12 21:09
Memberegenis1-May-12 21:09 
AnswerRe: SIFT Pin
Abhinav S1-May-12 21:27
MemberAbhinav S1-May-12 21:27 
GeneralRe: SIFT Pin
ri19871-May-12 22:48
Memberri19871-May-12 22:48 
GeneralRe: SIFT Pin
ri19872-May-12 22:13
Memberri19872-May-12 22:13 
GeneralRe: SIFT Pin
ri19872-May-12 22:16
Memberri19872-May-12 22:16 
JokeRe: SIFT Pin
PIEBALDconsult2-May-12 12:05
professionalPIEBALDconsult2-May-12 12:05 
GeneralRe: SIFT Pin
Pete O'Hanlon2-May-12 12:32
mvaPete O'Hanlon2-May-12 12:32 
GeneralRe: SIFT Pin
Member 1239536925-Apr-16 0:11
MemberMember 1239536925-Apr-16 0:11 
QuestionHow to Override FileSystemInfo Class Readonly properties (Exists, Extension, Name, and etc)? Pin
ShadowUz1-May-12 20:34
MemberShadowUz1-May-12 20:34 
AnswerRe: How to Override FileSystemInfo Class Readonly properties (Exists, Extension, Name, and etc)? Pin
egenis1-May-12 21:05
Memberegenis1-May-12 21:05 
QuestionShowingTabs After Authentication Pin
AmbiguousName1-May-12 20:03
MemberAmbiguousName1-May-12 20:03 
AnswerRe: ShowingTabs After Authentication Pin
Eddy Vluggen2-May-12 1:02
professionalEddy Vluggen2-May-12 1:02 
Questionembed javascript code in c# Pin
mrx1001-May-12 13:02
Membermrx1001-May-12 13:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.