Class CustomImplementationFactory
Contents
[
Hide
]CustomImplementationFactory class
Factory to create some instances which may be re-implemented by user for special purpose.
public class CustomImplementationFactory
Constructors
Name | Description |
---|---|
CustomImplementationFactory() | The default constructor. |
Methods
Name | Description |
---|---|
virtual CreateCultureInfo(int) | Create one CultureInfo by given id. |
virtual CreateMemoryStream() | Create one instance of MemoryStream or custom implementation of MemoryStream. |
virtual CreateMemoryStream(int) | Create one instance of MemoryStream or custom implementation of MemoryStream. |
virtual CreateRandomInstance() | Create one instance of random number generator. |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using System;
using System.Globalization;
using System.IO;
public class CustomImplementationFactoryDemo
{
public static void CustomImplementationFactoryExample()
{
// Create an instance of CustomImplementationFactory
CustomImplementationFactory factory = new CustomImplementationFactory();
// Demonstrate the CreateMemoryStream method without parameters
MemoryStream memoryStream1 = factory.CreateMemoryStream();
Console.WriteLine("MemoryStream created without parameters.");
// Demonstrate the CreateMemoryStream method with capacity parameter
int capacity = 1024;
MemoryStream memoryStream2 = factory.CreateMemoryStream(capacity);
Console.WriteLine($"MemoryStream created with capacity: {capacity}.");
// Demonstrate the CreateCultureInfo method
int lcid = 1033; // LCID for English - United States
CultureInfo cultureInfo = factory.CreateCultureInfo(lcid);
Console.WriteLine($"CultureInfo created with LCID: {lcid}.");
// Demonstrate the CreateRandomInstance method
Random random = factory.CreateRandomInstance();
Console.WriteLine("Random instance created.");
// Example usage of the factory with CellsHelper
CellsHelper.CustomImplementationFactory = factory;
Console.WriteLine("CustomImplementationFactory set in CellsHelper.");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells