Say we have the following class:
public class Person
{
public string Name { get; set; }
public Person(string name)
{
Name = name;
}
public string SayName()
{
string hello = "Hello! My name is ";
return hello + name;
}
}
Person p = new Person("John");
string yourName = p.SayName();
The function SayName()is located on Call Stack, and the object Person pand its properties ( Name) will remain in memory until Garbage Collectionit enters and clears it.
() , , , Reader Connection. Reader Connection, using.
-:
using(DatabaseConnection dbConn = new DatabaseConnection()
{
}