License key optimization

Hi! im trying out a speed test for my program.
code:

    string licenseFilename = Path.Combine(@"Path", "Aspose.Words.NET.lic");
    License license = new License();
    license.SetLicense(licenseFilename);

Is it a faster way to retrieve the license key, this code is running everytime the class runs ? am Using a trial key.

@henrikJohansen You should call SetLicense in your startup code before using Aspose.Words classes. Calling SetLicense multiple times is not harmful, it just wastes processor time. In your case you can call SetLicense in the static constructor of your test class.

1 Like

Is it another way to invoke the license other than using the license file. Iā€™m concerned about the pathing, that at a later stage someone will delete the file or something. I see that some other converters just needs a key inside the code to be initialized.

@henrikJohansen I think in your case, you can store the license as an embedded resource. In this case, the license file will be a part of your library and you will not rely on the paths.

1 Like