Show / Hide Table of Contents

Class Generate

Provides a set of static methods for generating different types of values or sequences of values.

Inheritance
Object
Generate
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class Generate

Methods

| Improve this Doc View Source

FixedString(Char, Int32)

Generates a string from the specified Unicode character repeated until the specified length.

Declaration
public static string FixedString(char c, int count)
Parameters
Type Name Description
Char c

A Unicode character.

Int32 count

The number of times c occurs.

Returns
Type Description
String

A String filled with the specified c until the specified count.

Exceptions
Type Condition
ArgumentOutOfRangeException

count is less than zero.

| Improve this Doc View Source

HashCode32(IEnumerable<IConvertible>)

Computes a suitable hash code from the specified sequence of convertibles.

Declaration
public static int HashCode32(IEnumerable<IConvertible> convertibles)
Parameters
Type Name Description
IEnumerable<IConvertible> convertibles

A sequence of objects implementing the IConvertible interface.

Returns
Type Description
Int32

A 32-bit signed integer that is the hash code of convertibles.

| Improve this Doc View Source

HashCode32(IConvertible[])

Computes a suitable hash code from the variable number of convertibles.

Declaration
public static int HashCode32(params IConvertible[] convertibles)
Parameters
Type Name Description
IConvertible[] convertibles

A variable number of objects implementing the IConvertible interface.

Returns
Type Description
Int32

A 32-bit signed integer that is the hash code of convertibles.

| Improve this Doc View Source

HashCode64(IEnumerable<IConvertible>)

Computes a suitable hash code from the specified sequence of convertibles.

Declaration
public static long HashCode64(IEnumerable<IConvertible> convertibles)
Parameters
Type Name Description
IEnumerable<IConvertible> convertibles

A sequence of objects implementing the IConvertible interface.

Returns
Type Description
Int64

A 64-bit signed integer that is the hash code of convertibles.

| Improve this Doc View Source

HashCode64(IConvertible[])

Computes a suitable hash code from the variable number of convertibles.

Declaration
public static long HashCode64(params IConvertible[] convertibles)
Parameters
Type Name Description
IConvertible[] convertibles

A variable number of objects implementing the IConvertible interface.

Returns
Type Description
Int64

A 64-bit signed integer that is the hash code of convertibles.

| Improve this Doc View Source

ObjectPortrayal(Object, Action<ObjectPortrayalOptions>)

Generates a portrayal of the specified instance that might contain information about the instance state.

Declaration
public static string ObjectPortrayal(object instance, Action<ObjectPortrayalOptions> setup = null)
Parameters
Type Name Description
Object instance

The instance of an Object to convert.

Action<ObjectPortrayalOptions> setup

The ObjectPortrayalOptions which may be configured.

Returns
Type Description
String

A String that represents the specified instance.

Remarks

When determining the representation of the specified instance, these default rules applies: 1: if the ToString() method has been overridden, any further processing is skipped (the assumption is, that a custom representation is already in place) 2: any public properties having index parameters is skipped 3: any public properties is appended to the result if ToString() has not been overridden Note: do not call this method from an overridden ToString(..) method without setting BypassOverrideCheck to true; otherwise a StackOverflowException will occur.

| Improve this Doc View Source

RandomNumber(Int32)

Generates a random integer that is within a specified range.

Declaration
public static int RandomNumber(int maximumExclusive = 2147483647)
Parameters
Type Name Description
Int32 maximumExclusive

The exclusive upper bound of the random number returned. maximumExclusive must be greater than or equal to 0.

Returns
Type Description
Int32

A 32-bit signed integer greater than or equal to 0 and less than maximumExclusive; that is, the range of return values includes 0 but not maximumExclusive. If 0 equals maximumExclusive, 0 is returned.

| Improve this Doc View Source

RandomNumber(Int32, Int32)

Generates a random integer that is within a specified range.

Declaration
public static int RandomNumber(int minimumInclusive, int maximumExclusive)
Parameters
Type Name Description
Int32 minimumInclusive

The inclusive lower bound of the random number returned.

Int32 maximumExclusive

The exclusive upper bound of the random number returned. maximumExclusive must be greater than or equal to minimumInclusive.

Returns
Type Description
Int32

A 32-bit signed integer greater than or equal to minimumInclusive and less than maximumExclusive; that is, the range of return values includes minimumInclusive but not maximumExclusive. If minimumInclusive equals maximumExclusive, minimumInclusive is returned.

Exceptions
Type Condition
ArgumentOutOfRangeException

minimumInclusive is greater than maximumExclusive.

| Improve this Doc View Source

RandomString(Int32)

Generates a random string with the specified length using values of LettersAndNumbers.

Declaration
public static string RandomString(int length)
Parameters
Type Name Description
Int32 length

The length of the random string to generate.

Returns
Type Description
String

A random string from the values of LettersAndNumbers.

| Improve this Doc View Source

RandomString(Int32, String[])

Generates a random string with the specified length from the provided values.

Declaration
public static string RandomString(int length, params string[] values)
Parameters
Type Name Description
Int32 length

The length of the random string to generate.

String[] values

The values to use in the randomization process.

Returns
Type Description
String

A random string from the values provided.

Exceptions
Type Condition
ArgumentNullException

values cannot be null.

ArgumentException

values contains no elements.

| Improve this Doc View Source

RangeOf<T>(Int32, Func<Int32, T>)

Generates a sequence of T within a specified range.

Declaration
public static IEnumerable<T> RangeOf<T>(int count, Func<int, T> generator)
Parameters
Type Name Description
Int32 count

The number of T to generate.

Func<Int32, T> generator

The function delegate that will resolve the instance of T; the parameter passed to the delegate represents the index (zero-based) of the element to return.

Returns
Type Description
IEnumerable<T>

An IEnumerable<T> that contains a range of T elements.

Type Parameters
Name Description
T

The type of the elements to return.

Exceptions
Type Condition
ArgumentOutOfRangeException

count is less than 0.

See Also

Eradicate
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright 2008-2022 Geekle. All rights reserved. Code with passion and love; deploy with confidence. 👨‍💻️🔥❤️🚀😎
Generated by DocFX