Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
As far as I know, You don't need to pass the connection by reference in order to close it. You need to pass a reference type instance by reference only when you write something like that:Though if you're going to be using it and want to close it in the class, you may need to pass it by reference
public void fun(MyClass MyInstance)
{
MyInstance = New MyInstance();
}
public void fun(MyClass MyInstance)
{
MyInstance = null;
}
public void fun(MyClass MyInstance)
{
MyInstance.MyInt = 3;
}
public void fun(OleDbConnection MyCon)
{
MyCon.Close();
}
Are yu sure about that? int is a value type and a connection object is a reference type, so if you pass an int to a method, it can change only the copy of this int. String is a reference type, but since it is immutable, it behaves like an int in this case.A connection object is an object like any other, so it obeys all the variable passing rules just as if it were a string, or an int, etc.