i want to know what is the use of "using" keyword in c#, i am new to it.. when we need to use "using" keyword.. i googled it, could not be satisfied with answers. still i want to know some more from you Geeks..  Thanks
4191
User  answered the wonderful  question by mentioning the using keyword. Can you elaborate on that? What are the uses of using?
44661
What is Lazy Loading?  [Edit after reading a few answers] Why do people use this term so often?   Say you just use a ASP/ADO recordset and load it with data or ADO.NET Datasource for a gridview.  I guess I should have asked why people use the term Lazy Loading, what "other" types are their?
40477
In C#, if I have an inherited class with a default constructor, do I have to explicitly call the base class' constructor or will it be implicitly called?  class BaseClass {     public BaseClass()     {         // ... some code     } } class MyClass : BaseClass {     public MyClass() // Do I need to put ": base()" here or is it implied?     {         // ... some code     } }
54935
How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want.
15520
My question is about when a function should be referenced with the extern keyword in C. I am failing to see when this should be used in practice.  As I am writing a program all of the functions that I use are made available through the header files I have included.  So why would it be useful to extern to get access to something that was not exposed in the header file? I could be thinking about how extern works incorrectly, and if so please correct me. Also.. Should you extern something when it is the default declaration without the keyword in a header file?
6520
My question is about one particular usage of static keyword. It is possible to use static keyword to cover a code block within a class which does not belong to any function. For example following code compiles:  public class Test {     private static final int a;         static {         a = 5;         doSomething(a);     }     private static int doSomething(int x) {         return (x+5);     } }   If you remove the static keyword it complains because the variable a is final. However it is possible to remove both final and static keywords and make it compile.   It is confusing for me in both ways. How am I supposed to have a code section that does not belong to any method? How is it possible to invoke it? In general, what is the purpose of this usage? Or better, where can I find documentation about this?
90316
Is there a way in C# where I can use reflection to set an object property?  Ex:  MyObject obj = new MyObject(); obj.Name = "Value";   I want to set obj.Name with reflection. Something like:  Reflection.SetProperty(obj, "Name") = "Value";   Is there a way of doing this?
29653
I know Googling I can find an appropriate answer, but I prefer listening to your personal (and maybe technical) opinions. What is the main reason of the difference between Java and C# in throwing exceptions? In Java the signature of a method that throws an exception has to use the "throws" keyword, while in C# you don't know in compilation time if an exception could be thrown.
81909
What is the difference between ref and out parameters in .NET? What are the situations where one can be more useful than the other? What would be a code snippet where one can be used and another can't?
86079
I recall there is a difference between some methods/properties called directly on the  class, and the identically named methods/properties on the  property. (Might have been the RowCount/Count property for which I read this.) The difference is one of them disregards , and the other respects/uses it.  In this particular case I'm wondering about the difference between  and . I can imagine one of them actually removes all rows, and the other one just marks them as deleted.  So my question is, is there a difference between the two Clear methods, and if so what is the difference?  (Oh, this is for .NET 1.1 btw, in case the semantics changed from one version to another.)
78162
I collect a few corner cases and  and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on the page, but which I find incredible:  string x = new string(new char[0]); string y = new string(new char[0]); Console.WriteLine(object.ReferenceEquals(x, y));   I'd expect that to print False - after all, "new" (with a reference type) always creates a new object, doesn't it? The specs for both C# and the CLI indicate that it should.  Well, not in this particular case. It prints True, and has done on every version of the framework I've tested it with. (I haven't tried it on Mono, admittedly...)  Just to be clear, this is only an example of the kind of thing I'm looking for - I wasn't particularly looking for discussion/explanation of this oddity. (It's not the same as normal string interning; in particular, string interning doesn't normally happen when a constructor is called.) I was really asking for similar odd behaviour.  Any other gems lurking out there?
39144
The default seems to be upper case, but is there really any reason to use upper case for keywords? I started using upper case because I was just trying to match what SQL Server gives me whenever I tried to create something, like a new stored procedure. But then, I felt terrible for my baby (5th) finger, that always needs to hold down the Shift button, so I stopped using upper case. Any reason why I should go back to upper case?  Edit: Thanks for the answers guys. I wasn't programming yet back in the days when  was king, so I wasn't aware of this. I'll stick with lower case from now on.
6154
In the example below, is the connection going to close and disposed when an exception is thrown if it is within a using statement?  using (var conn = new SqlConnection("...")) {     conn.Open();     // stuff happens here and exception is thrown... }   I know this code below will make sure that it does, but I'm curious how using statement does it.  var conn; try {     conn = new SqlConnection("...");     conn.Open();     // stuff happens here and exception is thrown... } // catch it or let it bubble up finally {     conn.Dispose(); }   Related:
108044
I don't think I fundamentally understand what an enum is, and when to use it.    For example:  typedef enum {     kCircle,     kRectangle,     kOblateSpheroid } ShapeType;   What is really being declared here?
5400
I’ve been looking over what has been posted regarding the use of ’s.   I used to be a Technical Writer (years ago). The title of one of our training documents was Users’ Guide.  Once, a coworker said every time he saw that title he expected users to start coming.    Never made any sense to me, but I have to admit that the majority of us didn't understand the use of s’ in place of ’s.  What is the difference?
90374
Sometimes both "using" and "by using" seem to have the same meaning. Am I wrong? For example, compare the sentences below:   "On-screen keyboards allow people with mobility impairments to type data using a joystick or a pointing device." "On-screen keyboards allow people with mobility impairments to type data by using a joystick or a pointing device."   Both sentences use "using" for the same purpose, don't  they? And their meanings are the same, aren't they?
27083
Duplicate:     I've read  already.  What does the "static" keyword in a method do?  I remember being told that static != clingy...but that is pretty much all I know about this keyword.