using-statement
I don't quite understand the workings of using/Disposable objects
I asked a question regarding returning a Disposable (IDisposable) object from a function, but I thought that I would muddle the discussion if I raised this question there.[详细]
2023-01-26 08:16 分类:问答Return a Disposable object for use in a using block
How do I return a disposable object in my function to ensure that it works properly within a using block?In my function, I want to act on the disposable object and also account for errors, which compl[详细]
2023-01-25 16:02 分类:问答Should I use a try/catch statement with the DataAdapter.Fill method?
using (SqlConnection sqlConn = new SqlConnection(XYZ.Globals.ConnectionString)) { using (SqlDataAdapter adapter = new SqlDataAdapter())[详细]
2023-01-25 15:33 分类:问答Global "using" directives in VS2010/C#?
I\'m pretty sure I know the answer but I\'m wondering if there\'s a way to define a global \"using\" directive in my C# projects so that I don\'t have to repeat the directive on top of every code file[详细]
2023-01-24 00:22 分类:问答using statement on IDisposable object - delay of calling Dispose method
As describe this article, about usage of using on IDisposable objects, it says one interesting words:[详细]
2023-01-22 23:31 分类:问答Export part of the namespace of a class
I have a class that includes an enum: class appearance{ // ... stuff ... enum color {BLUE, RED, GREEN}; };[详细]
2023-01-20 11:26 分类:问答Is C#'s using statement abort-safe?
I\'ve just finished reading \"C# 4.0 in a Nutshell\" (O\'Reilly) and I think it\'s a great book for a programmer willing to switch to C#, but it left me wondering. My problem is the definition of usin[详细]
2023-01-19 16:24 分类:问答How important is consistent usage of using declarations?
Most of the research I\'ve done on the use of using declarations, including reading relevant sections of various style guides, indicates that whether or not to use using declarations in C++ source fil[详细]
2023-01-18 00:10 分类:问答Formatting/indentation for using statements (C#)
When it comes to using statements in C# (not to be confused with using directives that import namespaces), Visual Studio doesn\'t indent single-line code that follows if no braces are employed. This i[详细]
2023-01-16 07:29 分类:问答Is there any research on (or better use of) of RAII in GC languages?
Note: Object Lifetime RAII not using/with block scope RAII It seems like its possible using an extra gc category, short lived objects(check gc category somewhat frequently), long lived objects(check[详细]
2023-01-15 09:35 分类:问答