Metered Class

Provides methods to set metered key.
Inheritance Hierarchy
SystemObject
  Aspose.WordsMetered

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public class Metered

The Metered type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleMetered
Initializes a new instance of this class.
Methods
  NameDescription
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.)
Examples
In this example, an attempt will be made to set metered public and private key
[C#]

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


[Visual Basic]

Dim matered As Metered = New Metered
matered.SetMeteredKey("PublicKey", "PrivateKey")
Examples
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