Repository navigation
OnixLabs.Core.Reflection.TypeDeclarationFlags
matthew edited this page May 27, 2026
·
1 revision
Specifies flags that control how a type name is formatted by GetCSharpTypeDeclaration.
| Namespace | OnixLabs.Core.Reflection |
| Assembly | OnixLabs.Core.dll (NuGet) |
[Flags]
public enum TypeDeclarationFlagsThis is a [Flags] enumeration, so its members can be combined with the bitwise OR (|) operator to control multiple aspects of the output simultaneously.
| Name | Value | Description |
|---|---|---|
None |
0 |
No type name arguments are applied. Only simple CLR type names are used, excluding generic type arguments and tuple syntax. |
UseNamespaceQualifiedTypeNames |
1 |
Namespace-qualified CLR type names are used where applicable. If the namespace-qualified name is not available, the type's simple CLR type name is used instead. |
UseAliasedTypeNames |
2 |
Type alias names (for example, int, string, bool) are used where applicable. Supersedes UseNamespaceQualifiedTypeNames: if an alias is not available, the namespace-qualified name is used when UseNamespaceQualifiedTypeNames is set; otherwise the simple CLR type name is used. |
UseNullableShorthandTypeNames |
4 |
Nullable<T> types are formatted using nullable shorthand syntax (for example, int?). Supersedes UseGenericTypeArguments. |
UseGenericTypeArguments |
8 |
If a type is generic, it is formatted with its generic type arguments (for example, List<Int32>). |
UseValueTupleSyntax |
16 |
ValueTuple types are formatted using tuple syntax (for example, (String, Int32)). Supersedes UseGenericTypeArguments. |
UseValueTupleNames |
32 |
ValueTuple types are formatted using tuple element names where applicable (for example, (String Item1, Int32 Item2)). Supersedes UseValueTupleSyntax and UseGenericTypeArguments. |
All |
63 |
All type name flags are set. Equivalent to UseNamespaceQualifiedTypeNames | UseAliasedTypeNames | UseNullableShorthandTypeNames | UseGenericTypeArguments | UseValueTupleSyntax | UseValueTupleNames. |
The flags interact according to a precedence chain that determines which formatting wins when multiple flags apply to the same construct:
-
UseAliasedTypeNamessupersedesUseNamespaceQualifiedTypeNamesfor types that have a C# language alias. -
UseNullableShorthandTypeNamessupersedesUseGenericTypeArgumentsforNullable<T>types. -
UseValueTupleSyntaxsupersedesUseGenericTypeArgumentsfor value tuples. -
UseValueTupleNamessupersedes bothUseValueTupleSyntaxandUseGenericTypeArgumentsfor value tuples.
The following table illustrates how typeof(int), typeof(int?), typeof(List<int>), and typeof((string, int)) render under representative flag combinations.
| Type | Flags | Result |
|---|---|---|
int |
None |
Int32 |
int |
UseAliasedTypeNames |
int |
int |
UseNamespaceQualifiedTypeNames |
System.Int32 |
int? |
UseNullableShorthandTypeNames |
Int32? |
int? |
UseNullableShorthandTypeNames | UseAliasedTypeNames |
int? |
int? |
UseGenericTypeArguments |
Nullable<Int32> |
List<int> |
UseGenericTypeArguments |
List<Int32> |
List<int> |
All |
System.Collections.Generic.List<int> |
(string, int) |
UseValueTupleSyntax |
(String, Int32) |
(string, int) |
UseValueTupleNames |
(String Item1, Int32 Item2) |
(string, int) |
All |
(string Item1, int Item2) |
- OnixLabs.Core.Reflection (namespace overview)
- Home
- TypeExtensions
- OnixLabs.Core on NuGet
ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions