Metered Class

Provides methods to set metered key.

Inheritance Hierarchy


Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.8.0


public class Metered

The Metered type exposes the following members.


Public methodCode exampleMetered
Initializes a new instance of this class.


Public methodEquals (Inherited from Object.)
Public methodStatic memberCode exampleGetConsumptionCredit
Gets consumption credit
Public methodStatic memberCode exampleGetConsumptionQuantity
Gets consumption file size
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleSetMeteredKey
Sets metered public and private key
Public methodToString (Inherited from Object.)


In this example, an attempt will be made to set metered public and private key

Metered matered = new Metered();
matered.SetMeteredKey("PublicKey", "PrivateKey");

[Visual Basic]

Dim matered As Metered = New Metered
matered.SetMeteredKey("PublicKey", "PrivateKey")
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");

// Print credit/usage 
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit()}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");

// Do something
Document doc = new Document(MyDir + "Document.docx");

// Print credit/usage to see how much was spent
Console.WriteLine($"Credit after operation: {Metered.GetConsumptionCredit()}");
Console.WriteLine($"Consumption quantity after operation: {Metered.GetConsumptionQuantity()}");

See Also