JoergG

Difference between .FreeForReuse() and .Dispose()

Recommended Posts

Hi Comminity,

 

What ist the difference between .FreeForReuse() and .Dispose() ?

Or what is the best practice to delete or get free my used ressources on libmanager, adminfacade and so on...

 

Deutsch:

Wo ist der Unterschied zwischen den Methoden .FreeForReuse() und .Dispose() z.b. beim Libmanager oder der Adminfacade.

Oder wie kann ich meine Ressourcen am besten wieder frei geben..

 

Best Regarts

Jörg

Share this post


Link to post
Share on other sites

Hello Jörg,

 

the method "FreeForReuse" is a Swyx implementation to release resource on the IpPbx Server.
The Dispose method is just the normal C# IDispose implementation and has no effect on the IpPbx Server.

 

I highly recommend to call the "Clear" and "FreeForReuse" method for every Enum object.

For LibManager and Facade objects only the "FreeForReuse" method should be called.

 

Examples:

// LIB MANAGER INIT
var libManager = new LibManager()
{
    BaseProtocol = SProxyObject.BaseProtocol.TCP,
    Username = "Username",
    Password = "Password",
    WSBaseUrl = "ServerAddress",
    AuthenticationMode = SProxyObject.AuthenticationMode.UsernamePassword
};
        
var adminFacade = libManager.GetAdminFacade();
// SOME FACADE METHODS CALLS
adminFacade.FreeForReuse();
adminFacade = null;

var userEnum = this.libManager.GetUserEnum();
// SOME ENUM METHODS CALLS
userEnum.Clear();
userEnum.FreeForReuse();
userEnum = null;

// LIB MANAGER CLEANUP
libManager.FreeForReuse();
libManager = null;

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now