• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Class ByteUnits

    Converts a size string with optional units into a count.

    K or KB1,000
    Ki or kiB1,024
    M or MB1000000
    Mi or MiB1,048,576
    G or GB1,000,000,000
    Gi or GiB1,073,741,824
    T or TB1,000,000,000,000
    Ti or TiB1,099,511,627,776
    P or PB1,000,000,000,000,000
    Pi or PiB1,125,899,906,842,624
    E or EB1,000,000,000,000,000,000‬
    Ei or EiB1,152,921,504,606,846,976‬
    Inheritance
    object
    ByteUnits
    Namespace: Neon.Common
    Assembly: Neon.Common.dll
    Syntax
    public static class ByteUnits

    Fields

    ExaBytes

    One PB: 1,000,000,000,000,000

    Declaration
    public const decimal ExaBytes = 1000000000000000000
    Field Value
    Type Description
    decimal

    ExbiBytes

    One PiB: 1,152,921,504,606,846,976‬ (2^60)

    Declaration
    public const decimal ExbiBytes = 1152921504606846976
    Field Value
    Type Description
    decimal

    GibiBytes

    One GiB: 1,073,741,824 (2^30)

    Declaration
    public const decimal GibiBytes = 1073741824
    Field Value
    Type Description
    decimal

    GigaBytes

    One GB: 1,000,000,000

    Declaration
    public const decimal GigaBytes = 1000000000
    Field Value
    Type Description
    decimal

    KibiBytes

    One KiB: 1,024 (2^10)

    Declaration
    public const decimal KibiBytes = 1024
    Field Value
    Type Description
    decimal

    KiloBytes

    One KB: 1,000

    Declaration
    public const decimal KiloBytes = 1000
    Field Value
    Type Description
    decimal

    MebiBytes

    One MiB: 1,048,576 (2^20)

    Declaration
    public const decimal MebiBytes = 1048576
    Field Value
    Type Description
    decimal

    MegaBytes

    One MB: 1,000,000

    Declaration
    public const decimal MegaBytes = 1000000
    Field Value
    Type Description
    decimal

    PebiBytes

    One PiB: 1,125,899,906,842,624 (2^50)

    Declaration
    public const decimal PebiBytes = 1125899906842624
    Field Value
    Type Description
    decimal

    PetaBytes

    One PB: 1,000,000,000,000

    Declaration
    public const decimal PetaBytes = 1000000000000000
    Field Value
    Type Description
    decimal

    TebiBytes

    The constant 1,099,511,627,776 (2^40)

    Declaration
    public const decimal TebiBytes = 1099511627776
    Field Value
    Type Description
    decimal

    TeraBytes

    The constant 1,000,000,000

    Declaration
    public const decimal TeraBytes = 1000000000000
    Field Value
    Type Description
    decimal

    Methods

    Humanize(decimal, bool, bool, bool)

    Humanizes the size passed into a string using appropriate units. This uses power-of-10 based units by default but you can switch to power-of-2 units by passing powerOfTwo as true.

    Declaration
    public static string Humanize(decimal size, bool powerOfTwo = false, bool spaceBeforeUnit = true, bool removeByteUnit = false)
    Parameters
    Type Name Description
    decimal size

    The size.

    bool powerOfTwo

    Optionally returns a power-of-2 based unit.

    bool spaceBeforeUnit

    Optionally excludes a space between the value and unit (this defaults to true.

    bool removeByteUnit

    Optionally strip any trailing "B" from the unit string. For example when this is set, a decimal value of 1000 will return 1K instead of 1KB.

    Returns
    Type Description
    string

    The converted string.

    Parse(string)

    Parses a size and returns a decimal.

    Declaration
    public static decimal Parse(string text)
    Parameters
    Type Name Description
    string text

    The value being parsed.

    Returns
    Type Description
    decimal

    The parsed value.

    Exceptions
    Type Condition
    FormatException

    Thrown if the value cannot be parsed.

    ToByteString(decimal)

    Converts a size to a string using byte units.

    Declaration
    public static string ToByteString(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in bytes.

    ToEB(decimal)

    Converts a size to a string using EB units.

    Declaration
    public static string ToEB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in EB.

    ToEiB(decimal)

    Converts a size to a string using EiB units.

    Declaration
    public static string ToEiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in EiB.

    ToGB(decimal)

    Converts a size to a string using GB units.

    Declaration
    public static string ToGB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in GB.

    ToGiB(decimal)

    Converts a size to a string using GiB units.

    Declaration
    public static string ToGiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in GiB.

    ToKB(decimal)

    Converts a size to a string using KB units.

    Declaration
    public static string ToKB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in KB.

    ToKiB(decimal)

    Converts a size to a string using KiB units.

    Declaration
    public static string ToKiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in KiB.

    ToMB(decimal)

    Converts a size to a string using MB units.

    Declaration
    public static string ToMB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in MB.

    ToMiB(decimal)

    Converts a size to a string using MiB units.

    Declaration
    public static string ToMiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in MiB.

    ToPB(decimal)

    Converts a size to a string using PB units.

    Declaration
    public static string ToPB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in PB.

    ToPiB(decimal)

    Converts a size to a string using PiB units.

    Declaration
    public static string ToPiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in PiB.

    ToTB(decimal)

    Converts a size to a string using TB units.

    Declaration
    public static string ToTB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in TB.

    ToTiB(decimal)

    Converts a size to a string using TiB units.

    Declaration
    public static string ToTiB(decimal size)
    Parameters
    Type Name Description
    decimal size

    The size.

    Returns
    Type Description
    string

    The size in TiB.

    TryParse(string, out decimal)

    Parses a floating point count string that may include one of the optional unit suffixes described here ByteUnits.

    Declaration
    public static bool TryParse(string input, out decimal value)
    Parameters
    Type Name Description
    string input

    The input string.

    decimal value

    Returns as the output value.

    Returns
    Type Description
    bool

    true on success

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC