Click here to Skip to main content
15,887,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
OriginalGriff16-Mar-14 0:05
mveOriginalGriff16-Mar-14 0:05 
GeneralW:Re: How create table in SQL Server using C# and data from Excel. Pin
Maciej Los16-Mar-14 0:14
mveMaciej Los16-Mar-14 0:14 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
jschell17-Mar-14 8:34
jschell17-Mar-14 8:34 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
OriginalGriff17-Mar-14 9:03
mveOriginalGriff17-Mar-14 9:03 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
jschell18-Mar-14 8:07
jschell18-Mar-14 8:07 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
OriginalGriff18-Mar-14 9:08
mveOriginalGriff18-Mar-14 9:08 
QuestionIEnumerable and disposal Pin
Rob Philpott14-Mar-14 0:31
Rob Philpott14-Mar-14 0:31 
AnswerRe: IEnumerable and disposal Pin
Richard Deeming14-Mar-14 2:06
mveRichard Deeming14-Mar-14 2:06 
Looking at section 8.8.4 of the C# Language Specification[^]:


A foreach statement of the form
C#
foreach (V v in x) embedded-statement

is then expanded to:
C#
{
    E e = ((C)(x)).GetEnumerator();
    try {
        while (e.MoveNext()) {
            V v = (V)(T)e.Current;
            embedded-statement
        }
    }
    finally {
        // Dispose e
    }
}


Therefore, regardless of whether your statement block breaks the loop, throws an exception, or runs to completion, the enumerator object will always be disposed.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: IEnumerable and disposal Pin
Rob Philpott14-Mar-14 2:27
Rob Philpott14-Mar-14 2:27 
GeneralRe: IEnumerable and disposal Pin
Simon_Whale14-Mar-14 2:30
Simon_Whale14-Mar-14 2:30 
GeneralRe: IEnumerable and disposal Pin
Simon_Whale14-Mar-14 2:29
Simon_Whale14-Mar-14 2:29 
AnswerRe: IEnumerable and disposal Pin
jschell14-Mar-14 11:57
jschell14-Mar-14 11:57 
QuestionSharepoint Gridview Pin
DipsMak13-Mar-14 23:21
professionalDipsMak13-Mar-14 23:21 
AnswerRe: Sharepoint Gridview Pin
Richard MacCutchan14-Mar-14 0:21
mveRichard MacCutchan14-Mar-14 0:21 
AnswerRe: Sharepoint Gridview Pin
DipsMak14-Mar-14 0:35
professionalDipsMak14-Mar-14 0:35 
GeneralRe: Sharepoint Gridview Pin
Richard MacCutchan14-Mar-14 1:35
mveRichard MacCutchan14-Mar-14 1:35 
Questionhow to have Pin
jojoba201113-Mar-14 19:14
jojoba201113-Mar-14 19:14 
AnswerRe: how to have Pin
BillWoodruff13-Mar-14 23:00
professionalBillWoodruff13-Mar-14 23:00 
AnswerRe: how to have Pin
Pete O'Hanlon13-Mar-14 23:11
mvePete O'Hanlon13-Mar-14 23:11 
QuestionRe: how to have Pin
jojoba201113-Mar-14 23:23
jojoba201113-Mar-14 23:23 
AnswerRe: how to have Pin
Eddy Vluggen13-Mar-14 23:30
professionalEddy Vluggen13-Mar-14 23:30 
AnswerRe: how to have Pin
Pete O'Hanlon13-Mar-14 23:57
mvePete O'Hanlon13-Mar-14 23:57 
AnswerRe: how to have Pin
Ravi Bhavnani14-Mar-14 6:41
professionalRavi Bhavnani14-Mar-14 6:41 
QuestionHelp Please Pin
Member 1045276713-Mar-14 10:38
Member 1045276713-Mar-14 10:38 
AnswerRe: Help Please Pin
Richard Andrew x6413-Mar-14 11:33
professionalRichard Andrew x6413-Mar-14 11:33 

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.