Archived Forum Post

Index of archived forum posts

Question:

Chilkat.Global's UnlockBundle method in a c# class library

Jan 28 '16 at 11:18

Is is possible to place the call to Chilkat.Global's UnlockBundle() method somewhere in a c# class library, where it is guaranteed to be executed at least once prior to any other Chilkat related code?

I prefer to not include the call to UnlockBundle() in all the methods, so that it clutters up the code unnecessarily. I could of course put the unlocking logic in a separate method and call that from all other methods, but I would like to avoid that if possible.

An example would be during unit testing of various methods implementing Chilkat functionality. There is no main application at this point and each method is tested independently.

I just want to make sure that I did not overlook an obvious approach.


Answer

Yes, this is exactly what you should do: Call Chilkat.Global.UnlockBundle once at the beginning of your program, and then all subsequently instantiated Chilkat objects will be created already unlocked. You don't even need to keep the instance of the Chilkat.Global object around. Just instantiate a Chilkat.Global object, call UnlockBundle, and then discard the Chilkat.Global instance.


Answer

Matt, sometimes it seems that you only get notified about answers and questions, but not comments. Please correct me if I am wrong. So just in case I will post this answer, so that you can respond to my comments.