Note
ãã®ããŒãžã«ã¢ã¯ã»ã¹ããã«ã¯ãæ¿èªãå¿ èŠã§ãã ãµã€ã³ã€ã³ãŸãã¯ãã£ã¬ã¯ããªã®å€æŽã詊ãããšãã§ããŸãã
ãã®ããŒãžã«ã¢ã¯ã»ã¹ããã«ã¯ãæ¿èªãå¿ èŠã§ãã ãã£ã¬ã¯ããªã®å€æŽã詊ãããšãã§ããŸãã
C.1 å šè¬
æºæ ãã C# å®è£ ã§ã¯ãç¹å®ã®ã»ãã³ãã£ã¯ã¹ãæã€åã®æå°ã»ãããæäŸããå¿ èŠããããŸãã ãããã®åãšãã®ã¡ã³ããŒã¯ãåå空éãšåã®ã¢ã«ãã¡ãããé ã«äžèŠ§è¡šç€ºãããŸãã (§C.2) ã§èå¥ãããåãšãã®ã¡ã³ããŒã®æ£åŒãªå®çŸ©ã«ã€ããŠã¯ãISO/IEC 23271:2012 å ±éèšèªã€ã³ãã©ã¹ãã©ã¯ã㣠(CLI)ãPartition IV ãåç §ããŠãã ãããåºæ¬ã¯ã©ã¹ ã©ã€ãã©ãª (BCL)ãæ¡åŒµæ°å€ã©ã€ãã©ãªãããã³æ¡åŒµé åã©ã€ãã©ãªããã®ä»æ§ã®ãªãã¡ã¬ã³ã¹ã«å«ãŸããŠããŸãã §C.2 ã§èå¥ãããŠãããã®ä»¥å€ã«å¿ èŠãªåãšãã®ã¡ã³ããŒã®äžèЧã«ã€ããŠã¯ã§C.3 ãåç §ããŠãã ããã
泚: CLI ã®ã©ã€ãã©ãª API ã®ãµãã»ãããæ¡çšããŠããCLI èªäœãžã®äŸåé¢ä¿ã¯äœæãããŸãããæºæ ããå®è£ ã CLI ã«åºã¥ããŠæ§ç¯ããããã¿ãŒã²ããã«ãããããå¿ èŠã¯ãããŸããã
ãã®ããã¹ãã¯æçã§ãã
æšæºã©ã€ãã©ãªã¯ãæºæ ãã C# å®è£ ã«å¿ èŠãªåãšã¡ã³ããŒã®æå°ã»ãããæå³ããŠããŸãã ãã®ãããC# èšèªä»æ§ã§æç€ºçã«å¿ èŠãªã¡ã³ããŒã®ã¿ãå«ãŸããŸãã
æºæ ãã C# å®è£ ã§ã¯ãæçšãªããã°ã©ã ãèšè¿°ã§ãããããåºç¯ãªã©ã€ãã©ãªãæäŸãããããšãæåŸ ãããŸãã ããšãã°ãæºæ ããå®è£ ã§ã¯ãæ¬¡ã®æ¹æ³ã§ãã®ã©ã€ãã©ãªãæ¡åŒµã§ããŸãã
- åå空éã®è¿œå ã
- åã®è¿œå ã
- ã€ã³ã¿ãŒãã§ã€ã¹ä»¥å€ã®åãžã®ã¡ã³ããŒã®è¿œå ã
- ä»åšããåºåºã¯ã©ã¹ãŸãã¯ã€ã³ã¿ãŒãã§ã€ã¹ã远å ããã
- æ§é äœãšã¯ã©ã¹åã䜿çšãããšã远å ã®ã€ã³ã¿ãŒãã§ã€ã¹ãå®è£ ãããŸãã
- æ¢åã®åãšã¡ã³ããŒã« (
ConditionalAttribute以å€ã®) 屿§ã远å ããã
æ å ±ããã¹ãã®æ«å°Ÿã
C.2 ISO/IEC 23271 ã§å®çŸ©ãããŠããæšæºã©ã€ãã©ãªã®çš®é¡
泚: 以äžã®äžéšã®
structåã«ã¯ãreadonly修食åããããŸãã ãã®ä¿®é£Ÿå㯠ISO/IEC 23271 ã®ãªãªãŒã¹æã«ã¯äœ¿çšã§ããŸããã§ãããããã®ä»æ§ã®å®è£ ã«æºæ ããããã«å¿ èŠã§ãã æ³šé
namespace System
{
public delegate void Action();
public class ArgumentException : SystemException
{
public ArgumentException();
public ArgumentException(string? message);
public ArgumentException(string? message, Exception? innerException);
}
public class ArgumentOutOfRangeException : ArgumentException
{
public ArgumentOutOfRangeException(string? paramName);
public ArgumentOutOfRangeException(string? paramName, string? message);
}
public class ArithmeticException : Exception
{
public ArithmeticException();
public ArithmeticException(string? message);
public ArithmeticException(string? message, Exception? innerException);
}
public abstract class Array : IList, ICollection, IEnumerable
{
public int Length { get; }
public int Rank { get; }
public int GetLength(int dimension);
}
public class ArrayTypeMismatchException : Exception
{
public ArrayTypeMismatchException();
public ArrayTypeMismatchException(string? message);
public ArrayTypeMismatchException(string? message,
Exception? innerException);
}
[AttributeUsageAttribute(AttributeTargets.All, Inherited = true,
AllowMultiple = false)]
public abstract class Attribute
{
protected Attribute();
}
public enum AttributeTargets
{
Assembly = 0x1,
Module = 0x2,
Class = 0x4,
Struct = 0x8,
Enum = 0x10,
Constructor = 0x20,
Method = 0x40,
Property = 0x80,
Field = 0x100,
Event = 0x200,
Interface = 0x400,
Parameter = 0x800,
Delegate = 0x1000,
ReturnValue = 0x2000,
GenericParameter = 0x4000,
All = 0x7FFF
}
[AttributeUsageAttribute(AttributeTargets.Class, Inherited = true)]
public sealed class AttributeUsageAttribute : Attribute
{
public AttributeUsageAttribute(AttributeTargets validOn);
public bool AllowMultiple { get; set; }
public bool Inherited { get; set; }
public AttributeTargets ValidOn { get; }
}
public readonly struct Boolean { }
public readonly struct Byte { }
public readonly struct Char { }
public readonly struct Decimal { }
public abstract class Delegate { }
public class DivideByZeroException : ArithmeticException
{
public DivideByZeroException();
public DivideByZeroException(string? message);
public DivideByZeroException(string? message, Exception? innerException);
}
public readonly struct Double { }
public abstract class Enum : ValueType
{
protected Enum();
}
public class Exception
{
public Exception();
public Exception(string? message);
public Exception(string? message, Exception? innerException);
public Exception? InnerException { get; }
public virtual string Message { get; }
}
public static class GC { }
public interface IDisposable
{
void Dispose();
}
public interface IEquatable<T> where T : allows ref struct
{
bool Equals(T? other);
}
public interface IFormattable { }
public sealed class IndexOutOfRangeException : Exception
{
public IndexOutOfRangeException();
public IndexOutOfRangeException(string? message);
public IndexOutOfRangeException(string? message,
Exception? innerException);
}
public readonly struct Int16 { }
public readonly struct Int32 { }
public readonly struct Int64 { }
public readonly struct IntPtr { }
public class InvalidCastException : Exception
{
public InvalidCastException();
public InvalidCastException(string? message);
public InvalidCastException(string? message, Exception? innerException);
}
public class InvalidOperationException : Exception
{
public InvalidOperationException();
public InvalidOperationException(string? message);
public InvalidOperationException(string? message,
Exception? innerException);
}
public class NotSupportedException : Exception
{
public NotSupportedException();
public NotSupportedException(string? message);
public NotSupportedException(string? message,
Exception? innerException);
}
public struct Nullable<T> where T : struct
{
public bool HasValue { get; }
public T Value { get; }
}
public class NullReferenceException : Exception
{
public NullReferenceException();
public NullReferenceException(string? message);
public NullReferenceException(string? message, Exception? innerException);
}
public class Object
{
public Object();
~Object();
public virtual bool Equals(object? obj);
public virtual int GetHashCode();
public Type GetType();
public virtual string? ToString();
}
[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Interface |
AttributeTargets.Constructor | AttributeTargets.Method |
AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Event | AttributeTargets.Delegate, Inherited = false)]
public sealed class ObsoleteAttribute : Attribute
{
public ObsoleteAttribute();
public ObsoleteAttribute(string? message);
public ObsoleteAttribute(string? message, bool error);
public bool IsError { get; }
public string? Message { get; }
}
public class OutOfMemoryException : Exception
{
public OutOfMemoryException();
public OutOfMemoryException(string? message);
public OutOfMemoryException(string? message, Exception? innerException);
}
public class OverflowException : ArithmeticException
{
public OverflowException();
public OverflowException(string? message);
public OverflowException(string? message, Exception? innerException);
}
public readonly struct SByte { }
public readonly struct Single { }
public sealed class StackOverflowException : Exception
{
public StackOverflowException();
public StackOverflowException(string? message);
public StackOverflowException(string? message, Exception? innerException);
}
public sealed class String : IEnumerable<char>, IEnumerable
{
public int Length { get; }
public char this [int index] { get; }
public static string Format(string format, params object?[] args);
System.Collections.IEnumerator IEnumerable.GetEnumerator();
System.Collections.Generic.IEnumerator<char> IEnumerable<char>.GetEnumerator();
}
public class SystemException : Exception
{
public SystemException();
public SystemException(string? message);
public SystemException(string? message, Exception? innerException);
}
public abstract class Type : MemberInfo { }
public sealed class TypeInitializationException : Exception
{
public TypeInitializationException(string fullTypeName,
Exception? innerException);
}
public readonly struct UInt16 { }
public readonly struct UInt32 { }
public readonly struct UInt64 { }
public readonly struct UIntPtr { }
public abstract class ValueType
{
protected ValueType();
}
}
namespace System.Collections
{
public interface ICollection : IEnumerable
{
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo(Array array, int index);
}
public interface IEnumerable
{
IEnumerator GetEnumerator();
}
public interface IEnumerator
{
object Current { get; }
bool MoveNext();
void Reset();
}
public interface IList : ICollection, IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object? this [int index] { get; set; }
int Add(object? value);
void Clear();
bool Contains(object? value);
int IndexOf(object? value);
void Insert(int index, object? value);
void Remove(object? value);
void RemoveAt(int index);
}
}
namespace System.Collections.Generic
{
public interface ICollection<T> : IEnumerable<T>
{
int Count { get; }
bool IsReadOnly { get; }
void Add(T item);
void Clear();
bool Contains(T item);
void CopyTo(T[] array, int arrayIndex);
bool Remove(T item);
}
public interface IEnumerable<T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
public interface IEnumerator<T> : IDisposable, IEnumerator
{
T Current { get; }
}
public interface IList<T> : ICollection<T>
{
T this [int index] { get; set; }
int IndexOf(T item);
void Insert(int index, T item);
void RemoveAt(int index);
}
}
namespace System.Diagnostics
{
[AttributeUsageAttribute(AttributeTargets.Method | AttributeTargets.Class,
AllowMultiple = true)]
public sealed class ConditionalAttribute : Attribute
{
public ConditionalAttribute(string conditionString);
public string ConditionString { get; }
}
}
namespace System.Reflection
{
public abstract class MemberInfo
{
protected MemberInfo();
}
}
namespace System.Runtime.CompilerServices
{
public sealed class IndexerNameAttribute : Attribute
{
public IndexerNameAttribute(string indexerName);
}
public static class Unsafe
{
public static ref T NullRef<T>();
public static bool IsNullRef<T>(ref T source);
}
}
namespace System.Threading
{
public static class Monitor
{
public static void Enter(object obj);
public static void Exit(object obj);
}
}
C.3 æšæºã©ã€ãã©ãªã®çš®é¡ã ISO/IEC 23271 ã§å®çŸ©ãããŠããªã
ãªã¹ãã«èšèŒãããŠããã¡ã³ããŒãå«ã次ã®åã¯ãæºæ ããæšæºã©ã€ãã©ãªã§å®çŸ©ããå¿ èŠããããŸãã (ãããã®åã¯ãISO/IEC 23271 ã®å°æ¥ã®ãšãã£ã·ã§ã³ã§å®çŸ©ãããå¯èœæ§ããããŸã)ããããã®åã®å€ãã¯ãäžèЧãããå€ãã®ã¡ã³ããŒã䜿çšã§ããå¿ èŠããããŸãã
æºæ ããå®è£
ã§ã¯ãæ¡åŒµã¡ãœãããšã㊠Task.GetAwaiter() ãš Task<TResult>.GetAwaiter() ãæäŸã§ããŸãã
namespace System
{
public interface IAsyncDisposable
{
System.Threading.Tasks.ValueTask DisposeAsync();
}
public abstract class FormattableString : IFormattable { }
public static class MemoryExtensions
{
public static ReadOnlySpan<char> AsSpan (this string? text);
public static bool SequenceEqual<T> (this Span<T> span, ReadOnlySpan<T> other)
where T : IEquatable<T>;
public static bool SequenceEqual<T> (this ReadOnlySpan<T> span,
ReadOnlySpan<T> other) where T : IEquatable<T>;
}
public class OperationCanceledException : Exception
{
public OperationCanceledException();
public OperationCanceledException(string? message);
public OperationCanceledException(string? message, Exception? innerException);
}
/// <summary>
/// A read-only value type which represents an abstract
/// index to be used with collections.
/// - The Index can be relative to the start or end of a
/// collection.
/// - An Index can be converted to a zero-based concrete
/// from-start index to be used with a collection
/// of some specified length.
/// - Equality between Index values is provided, however
/// unlike concrete indices they are not ordered.
/// - Array and String element access support indexing
/// with Index values.
/// </summary>
public readonly struct Index : IEquatable<Index>
{
/// <summary>
/// Construct an Index from an integer value and a
/// boolean indicating whether the value is relative
/// to the end (true) or start (false).
/// </summary>
/// <param name="value">
/// The value, must be ⥠0.
/// </param>
/// <param name="fromEnd">
/// Optional boolean indicating whether the Index is
/// relative to the end (true) or start (false).
/// The default value is false.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown if value < 0.
/// </exception>
/// <remarks>
/// If the Index is relative to the start then:
/// - the value 0 refers to the first element.
/// If the Index is relative to the end then:
/// - the value 1 refers to the last element; and
/// - the value 0 refers to beyond last element.
/// </remarks>
public Index(int value, bool fromEnd = false);
/// <summary>
/// Implicit conversion from integer to a
/// from-start Index.
/// </summary>
/// <remarks>
/// The predefined operator:
/// <c>Index operator ^(int value);</c>
/// is provided to convert from integer to a
/// from-end Index.
/// </remarks>
public static implicit operator Index(int value);
/// <summary>
/// Return the value.
/// </summary>
public int Value { get; }
/// <summary>
/// Return whether the Index is relative to
/// the end (true) or start (false).
/// </summary>
public bool IsFromEnd { get; }
/// <summary>
/// Return a concrete from-start index for a
/// given collection length.
/// </summary>
/// <param name="length">
/// The length of the collection that the index
/// will be used with.
/// </param>
/// <remarks>
/// This method performs no sanity checking and
/// will never throw an IndexOutOfRangeException.
/// It is expected that the returned index will be
/// used with a collection which will do validation.
/// </remarks>
public int GetOffset(int length);
/// <summary>
/// Indicates whether the current Index value is
/// equal to another Index value.
/// </summary>
/// <param name="other">
/// The value to compare with this Index.
/// </param>
public bool Equals(Index other);
}
/// <summary>
/// A read-only value type which represents a range of
/// abstract indices to be used with collections.
/// - The Range has two Index properties, Start and End.
/// - A Range can be converted to a concrete index from
/// the start and a length value to be used with a
/// collection of some specified length.
/// - Equality between Range values is provided,
/// however they are not ordered.
/// - Array and String element access supports indexing
/// with Range values, returning a sub-array/substring
/// of the indexed value respectively.
/// </summary>
public readonly struct Range : IEquatable<Range>
{
/// <summary>
/// Construct a Range from two Index values.
/// </summary>
/// <param name="start">
/// The inclusive Index value for the start
/// of the range.
/// </param>
/// <param name="end">
/// The exclusive Index value for the end
/// of the range.</param>
/// <remarks>
/// As Index values represent unordered abstract
/// indices no sanity checking can be performed
/// on the resultant Range value,
/// <see cref="GetOffsetAndLength">".
///
/// The predefined operator:
/// <c>Range operator ..(Index start, Index end);</c>
/// also exists to create a Range value.
/// </remarks>
public Range(Index start, Index end);
/// <summary>Return the starting Index.</summary>
public Index Start { get; }
/// <summary>Return the ending Index.</summary>
public Index End { get; }
/// <summary>
/// Return a concrete from-start index and the
/// range length for a given collection length.
/// </summary>
/// <param name="length">
/// The length of the collection that the result
/// will be used with.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown if the range is not valid wrt length.
/// </exception>
/// <returns>
/// A tuple consisting of an index value and range length
/// </returns>
public (int Offset, int Length) GetOffsetAndLength(int length);
/// <summary>
/// Indicates whether the current Range value is equal
/// to another Range value.
/// </summary>
/// <param name="other">
/// The value to compare with this Range.
/// </param>
public bool Equals(Range other);
}
public readonly ref struct ReadOnlySpan<T>
{
public int Length { get; }
public ref readonly T this[int index] { get; }
}
public readonly ref struct Span<T>
{
public int Length { get; }
public ref T this[int index] { get; }
public static implicit operator ReadOnlySpan<T>(Span<T> span);
}
public struct ValueTuple<T1>
{
public T1 Item1;
public ValueTuple(T1 item1);
}
public struct ValueTuple<T1, T2>
{
public T1 Item1;
public T2 Item2;
public ValueTuple(T1 item1, T2 item2);
}
public struct ValueTuple<T1, T2, T3>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public ValueTuple(T1 item1, T2 item2, T3 item3);
}
public struct ValueTuple<T1, T2, T3, T4>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4);
}
public struct ValueTuple<T1, T2, T3, T4, T5>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5);
}
public struct ValueTuple<T1, T2, T3, T4, T5, T6>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6);
}
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6, T7 item7);
}
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public TRest Rest;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6, T7 item7, TRest rest);
}
}
namespace System.Collections.Generic
{
public interface IReadOnlyCollection<out T> : IEnumerable<T>
{
int Count { get; }
}
public interface IReadOnlyList<out T> : IReadOnlyCollection<T>
{
T this [int index] { get; }
}
public interface IAsyncEnumerable<out T>
{
IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken token = default);
}
public interface IAsyncEnumerator<out T> : IAsyncDisposable
{
System.Threading.Tasks.ValueTask<bool> MoveNextAsync();
T Current { get; }
}
}
namespace System.Diagnostics.CodeAnalysis
{
[System.AttributeUsage(System.AttributeTargets.Field |
System.AttributeTargets.Parameter | System.AttributeTargets.Property,
Inherited=false)]
public sealed class AllowNullAttribute : Attribute
{
public AllowNullAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Field |
System.AttributeTargets.Parameter | System.AttributeTargets.Property,
Inherited=false)]
public sealed class DisallowNullAttribute : Attribute
{
public DisallowNullAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class DoesNotReturnAttribute : Attribute
{
public DoesNotReturnAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Parameter, Inherited=false)]
public sealed class DoesNotReturnIfAttribute : Attribute
{
public DoesNotReturnIfAttribute(bool parameterValue);
}
[System.AttributeUsage(System.AttributeTargets.Field |
System.AttributeTargets.Parameter | System.AttributeTargets.Property |
System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed class MaybeNullAttribute : Attribute
{
public MaybeNullAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Parameter, Inherited=false)]
public sealed class MaybeNullWhenAttribute : Attribute
{
public MaybeNullWhenAttribute(bool returnValue);
}
[System.AttributeUsage(System.AttributeTargets.Method |
System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed class MemberNotNullAttribute : Attribute
{
public MemberNotNullAttribute(string member) {}
public MemberNotNullAttribute(params string[] members) {}
}
[System.AttributeUsage(System.AttributeTargets.Method |
System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed class MemberNotNullWhenAttribute : Attribute
{
public MemberNotNullWhenAttribute(bool returnValue, string member) {}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members) {}
}
[System.AttributeUsage(System.AttributeTargets.Field |
System.AttributeTargets.Parameter | System.AttributeTargets.Property |
System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed class NotNullAttribute : Attribute
{
public NotNullAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Parameter |
System.AttributeTargets.Property | System.AttributeTargets.ReturnValue,
AllowMultiple=true, Inherited=false)]
public sealed class NotNullIfNotNullAttribute : Attribute
{
public NotNullIfNotNullAttribute(string parameterName);
}
[System.AttributeUsage(System.AttributeTargets.Parameter, Inherited=false)]
public sealed class NotNullWhenAttribute : Attribute
{
public NotNullWhenAttribute(bool returnValue);
}
[System.AttributeUsage(System.AttributeTargets.Method
| System.AttributeTargets.Parameter
| System.AttributeTargets.Property,
AllowMultiple=false, Inherited=false)]
public sealed class UnscopedRefAttribute : Attribute
{
public UnscopedRefAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Constructor,
AllowMultiple=false, Inherited=false)]
public sealed class SetsRequiredMembersAttribute : Attribute
{
public SetsRequiredMembersAttribute() {}
}
}
namespace System.Linq.Expressions
{
public sealed class Expression<TDelegate>
{
public TDelegate Compile();
public static UnaryExpression NegateChecked(Expression expression,
MethodInfo? method);
public static BinaryExpression AddChecked(Expression left,
Expression right, MethodInfo? method);
public static BinaryExpression SubtractChecked(Expression left,
Expression right, MethodInfo? method);
public static BinaryExpression MultiplyChecked(Expression left,
Expression right, MethodInfo? method);
public static UnaryExpression ConvertChecked(Expression expression,
Type type, MethodInfo? method);
}
}
namespace System.Runtime.CompilerServices
{
[System.AttributeUsage(System.AttributeTargets.Class
| System.AttributeTargets.Interface
| System.AttributeTargets.Struct, Inherited=false)]
public sealed class CollectionBuilderAttribute : System.Attribute
{
public CollectionBuilderAttribute(Type builderType, string methodName);
public Type BuilderType { get; }
public string MethodName { get; }
}
public ref struct DefaultInterpolatedStringHandler
{
public DefaultInterpolatedStringHandler(int literalLength,
int formattedCount);
public DefaultInterpolatedStringHandler(int literalLength,
int formattedCount, IFormatProvider? provider);
public DefaultInterpolatedStringHandler(int literalLength,
int formattedCount, IFormatProvider? provider, Span<char> initialBuffer);
public void AppendFormatted(scoped ReadOnlySpan<char> value);
public void AppendFormatted(string? value);
public void AppendFormatted(object? value, int alignment = 0,
string? format = default);
public void AppendFormatted(scoped ReadOnlySpan<char> value,
int alignment = 0, string? format = default);
public void AppendFormatted(string? value, int alignment = 0,
string? format = default);
public void AppendFormatted<T>(T value);
public void AppendFormatted<T>(T value, int alignment);
public void AppendFormatted<T>(T value, string? format);
public void AppendFormatted<T>(T value, int alignment, string? format);
public void AppendLiteral(string value);
public override string ToString();
public string ToStringAndClear();
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Interface | AttributeTargets.Method,
Inherited = false, AllowMultiple = false)]
public sealed class AsyncMethodBuilderAttribute : Attribute
{
public AsyncMethodBuilderAttribute(Type builderType);
public Type BuilderType { get; }
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false,
Inherited = false)]
public sealed class CallerArgumentExpressionAttribute : Attribute
{
public CallerArgumentExpressionAttribute(string parameterName);
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class CallerFilePathAttribute : Attribute
{
public CallerFilePathAttribute();
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class CallerLineNumberAttribute : Attribute
{
public CallerLineNumberAttribute();
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class CallerMemberNameAttribute : Attribute
{
public CallerMemberNameAttribute();
}
[System.AttributeUsage(System.AttributeTargets.Parameter, Inherited=false)]
public sealed class EnumeratorCancellationAttribute : Attribute
{
public EnumeratorCancellationAttribute();
}
public static class FormattableStringFactory
{
public static FormattableString Create(string format,
params object?[] arguments);
}
public interface ICriticalNotifyCompletion : INotifyCompletion
{
void UnsafeOnCompleted(Action continuation);
}
[AttributeUsage(AttributeTargets.Struct, AllowMultiple=false)]
public sealed class InlineArrayAttribute : Attribute
{
public InlineArrayAttribute(int length);
public int Length { get; }
}
public interface INotifyCompletion
{
void OnCompleted(Action continuation);
}
[System.AttributeUsage(System.AttributeTargets.Parameter,
AllowMultiple=false, Inherited=false)]
public sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public InterpolatedStringHandlerArgumentAttribute(string argument);
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments);
}
[System.AttributeUsage(System.AttributeTargets.Class |
System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed class InterpolatedStringHandlerAttribute : Attribute
{
public InterpolatedStringHandlerAttribute ();
}
/// <summary>
/// Provides indexed access to the elements of a
/// tuple-like value at runtime. This interface is
/// used by the language to implement positional
/// pattern matching (§11.2.5) when no static
/// tuple type or <c>Deconstruct</c> method is
/// available.
/// </summary>
public interface ITuple
{
/// <summary>
/// The number of elements in the tuple.
/// </summary>
/// <remarks>
/// The value returned shall be non-negative,
/// and shall not change for the lifetime of
/// the instance.
/// </remarks>
int Length { get; }
/// <summary>
/// Returns the element at the specified
/// zero-based position.
/// </summary>
/// <param name="index">
/// The zero-based position of the element
/// to return; shall be ⥠0 and < <see cref="Length"/>.
/// </param>
/// <exception cref="IndexOutOfRangeException">
/// Thrown if <paramref name="index"/> is
/// outside the range
/// <c>[0, Length)</c>.
/// </exception>
object? this[int index] { get; }
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class ModuleInitializerAttribute : Attribute
{
public ModuleInitializerAttribute() { }
}
[System.AttributeUsage(System.AttributeTargets.Constructor
| System.AttributeTargets.Method | System.AttributeTargets.Property,
AllowMultiple=false, Inherited=false)]
public sealed class OverloadResolutionPriorityAttribute : Attribute
{
public OverloadResolutionPriorityAttribute(int priority) {}
}
[System.AttributeUsage(System.AttributeTargets.Class |
System.AttributeTargets.Field | System.AttributeTargets.Property |
System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed class RequiredMemberAttribute : Attribute
{
public RequiredMemberAttribute() {}
}
public readonly struct TaskAwaiter : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public void GetResult();
}
public readonly struct TaskAwaiter<TResult> : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public TResult GetResult();
}
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class UnmanagedCallersOnlyAttribute : Attribute
{
public UnmanagedCallersOnlyAttribute ();
public Type[]? CallConvs;
public string? EntryPoint;
}
public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public void GetResult();
}
public readonly struct ValueTaskAwaiter<TResult>
: ICriticalNotifyCompletion, INotifyCompletion
{
public bool IsCompleted { get; }
public TResult GetResult();
}
}
namespace System.Threading
{
public class CancellationTokenSource : IDisposable
{
public CancellationTokenSource();
public System.Threading.CancellationToken Token { get; }
public void Cancel();
public static CancellationTokenSource CreateLinkedTokenSource
(CancellationToken token1,
CancellationToken token2);
}
public readonly struct CancellationToken : IEquatable<CancellationToken>
{
public bool IsCancellationRequested { get; }
}
public sealed class Lock
{
public Lock();
public System.Threading.Lock.Scope EnterScope();
public ref struct Lock.Scope
{
public void Dispose();
}
}
}
namespace System.Threading.Tasks
{
public class Task
{
public System.Runtime.CompilerServices.TaskAwaiter GetAwaiter();
}
public class Task<TResult> : Task
{
public new System.Runtime.CompilerServices.TaskAwaiter<TResult> GetAwaiter();
}
public readonly struct ValueTask : System.IEquatable<ValueTask>
{
public System.Runtime.CompilerServices.ValueTaskAwaiter GetAwaiter();
}
public readonly struct ValueTask<TResult>
: System.IEquatable<ValueTask<TResult>>
{
public new System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>
GetAwaiter();
}
}
C.4 圢åŒã®ä»æ§
æ¿å
¥æåååŒ (§12.8.3) ã§äœ¿çšãããæžåŒã®æå³ã¯ãISO/IEC 23271:2012 ã§å®çŸ©ãããŠããŸãã 䟿å®äžã System.IFormattableã®èª¬æããæ¬¡ã®ããã¹ããã³ããŒãããŸãã
ãã®ããã¹ãã¯æçã§ãã
format ã¯ããªããžã§ã¯ããæååã«å€æããããšãã®å€èгã衚ãæååã§ãã æšæºåœ¢åŒãŸãã¯ã«ã¹ã¿ã 圢åŒã䜿çšã§ããŸãã æšæºåœ¢åŒã¯ Axx ãšãã圢åŒã«ãªããŸããããã§ã A 㯠format specifier ãšåŒã°ãã 1 æåã®è±åã§ã xx 㯠0 ãã 99 ãŸã§ã®æŽæ°ã§ã precision æå®åãšåŒã°ããŸãã æžåŒæå®åã¯ãæååãšããŠè¡šãããå€ã«é©çšãããæžåŒèšå®ã®çš®é¡ãå¶åŸ¡ããŸãã precision æå®åã¯ãæååå ã®æå¹æ¡æ°ãŸãã¯å°æ°ç¹ä»¥äžæ¡æ° (該åœããå Žå) ãå¶åŸ¡ããŸãã
泚: æšæºæžåŒæå®åã®äžèЧã«ã€ããŠã¯ã次ã®è¡šãåç §ããŠãã ããã
System.Int32ãªã©ã®ç¹å®ã®ããŒã¿åã§ã¯ã1 ã€ä»¥äžã®æšæºæžåŒæå®åããµããŒããããªãå Žåãããããšã«æ³šæããŠãã ããã æ³šé
泚: æžåŒã«ã«ã«ãã£ã«ãã£ãŠç°ãªãèšå· ('C' 圢åŒã 'c' 圢åŒã«å«ãŸãã currencysymbol ãªã©) ãå«ãŸããŠããå ŽåãæžåŒèšå®ãªããžã§ã¯ãã¯æåå衚çŸã§äœ¿çšãããå®éã®æåãæäŸããŸãã ã¡ãœããã«ã¯ãæžåŒèšå®ãªããžã§ã¯ããæäŸãã
System.IFormatProviderãªããžã§ã¯ããæž¡ããã©ã¡ãŒã¿ãŒãå«ãŸããŠããå ŽåããçŸåšã®ã«ã«ãã£ã®ã·ã³ãã«å®çŸ©ãå«ãæ¢å®ã®æžåŒèšå®ãªããžã§ã¯ãã䜿çšããå ŽåããããŸãã çŸåšã®ã«ã«ãã£ã§ã¯ãéåžžãæ¢å®ã§ã·ã¹ãã å šäœã§äœ¿çšãããŠããã®ãšåãã·ã³ãã« ã»ããã䜿çšãããŸãã åºæ¬ã¯ã©ã¹ ã©ã€ãã©ãªã§ã¯ãã·ã¹ãã æå®ã®æ°å€åã®æžåŒèšå®ãªããžã§ã¯ãã¯System.Globalization.NumberFormatInfoã€ã³ã¹ã¿ã³ã¹ã§ããSystem.DateTimeã€ã³ã¹ã¿ã³ã¹ã®å Žåã¯ãSystem.Globalization.DateTimeFormatInfoã䜿çšãããŸãã æ³šé
次ã®è¡šã§ã¯ãåºæ¬ã¯ã©ã¹ ã©ã€ãã©ãªã®æ°å€ããŒã¿åã§äœ¿çšãããæšæºæžåŒæå®åãšé¢é£ããæžåŒèšå®ãªããžã§ã¯ã ã¡ã³ããŒã«ã€ããŠèª¬æããŸãã
| æžåŒæå®å | 説æ |
|---|---|
|
é貚圢åŒ: é貚å€ãå«ãæååã«äœ¿çšãããŸãã
粟床æå®åãçç¥ãããšã |
|
Decimal Format: (ãã®åœ¢åŒã¯æŽæ°ããŒã¿åã§æå®ãããŠããå Žåã«ã®ã¿æå¹ã§ã)ãæŽæ°å€ãå«ãæååã«äœ¿çšãããŸãã è² ã®æ°å€ã«ã¯ã 粟床æå®åã¯ãæååã«è¡šç€ºãããæå°æ¡æ°ã決å®ããŸãã æå®ããæå¹æ¡æ°ã«å«ãŸããæ°å€ãããå€ãã®æ¡æ°ãå¿ èŠãªå Žåãæååã¯ãŒãã§å·Šã«åããããŸãã æå¹æ¡æ°æå®åãæå®ããæ¡æ°ãå€ãããå°ãªãå Žåãæå¹æ¡æ°æå®åã¯ç¡èŠãããŸãã |
|
ç§åŠ (ãšã³ãžãã¢ãªã³ã°) 圢åŒ: 次ã®ããããã®åœ¢åŒã®æååã«äœ¿çšãããŸãã [-]m.dddddddE +xxx [-]m.dddddddE-xxx [-]m.dddddd e+xxx [-]m.dddddde-xxx è² ã®æ°å€èšå· ('-') ã¯ãå€ãè² ã®å€ã§ããã 0 以å€ã® 10 鲿° (m) ãå°æ°ç¹ ('.') ã®åã«çœ®ãã 粟床æå®åã¯ãæååå ã®å°æ°ç¹ä»¥äžã®æ¡æ° (ddddddd) ãæ±ºå®ããŸãã æå¹æ¡æ°æå®åãçç¥ãããšãå°æ°ç¹ä»¥äž 6 æ¡ãæååã«å«ãŸããŸãã ææ° (+/-xxx) ã¯ãæ£ãŸãã¯è² ã®æ°ã®èšå·ã®åŸã« 3 æ¡ä»¥äž (xxx) ã§æ§æãããŸãã ææ°ã¯ãå¿
èŠã«å¿ããŠãŒãã§å·Šã«åããããŸãã æžåŒæå®å ('E' ãŸã㯠'e') ã®å€§æåãšå°æåã¯ãæååã®ææ°ãã¬ãã£ãã¯ã¹ (E ãŸã㯠e) ã«äœ¿çšãããã±ãŒã¹ã決å®ããŸãã å¿
èŠã«å¿ããŠãçµæã¯æãè¿ã衚çŸå¯èœãªå€ã«äžžããããŸãã æ£ã®æ°å€èšå·ã¯ã |
|
åºå®å°æ°ç¹åœ¢åŒ: 次ã®åœ¢åŒã®æååã«äœ¿çšãããŸãã [-]m.dd...d 0 以å€ã® 10 鲿° (m) ã®åã«å°æ°ç¹ ('.') ã 1 ã€ä»¥äžä»ããŠããŸããããã¯ã è² ã®æ°å€èšå· ('-') ã¯ãå€ãè² ã®å Žåã«ã®ã¿m ã®åã«ãããŸãã ãã®ã·ã³ãã«ã¯ã 粟床æå®åã¯ãå°æ°ç¹ä»¥äžã®æ¡æ° (dd...d) ãæå®ããŸãã 粟床æå®åãçç¥ãããšã |
|
General Format: æååã¯ãåºå®å°æ°ç¹åœ¢åŒ ('F' ãŸã㯠'f') ãŸãã¯ç§åŠåœ¢åŒ ('E' ãŸã㯠'e') ã§æžåŒèšå®ãããŸãã æŽæ°åã®å Žå: exponent<粟床æå®åã®å Žåãå€ã¯åºå®å°æ°ç¹åœ¢åŒã䜿çšããŠæžåŒèšå®ãããŸããããã§ãexponent ã¯ææ°åœ¢åŒã®å€ã®ææ°ã§ãã ãã®ä»ã®ãã¹ãŠã®å€ã«ã¯ãç§åŠçãªåœ¢åŒã䜿çšãããŸãã 粟床æå®åãçç¥ãããšãããŒã¿åã®æå€§å€ã衚瀺ããããã«å¿ èŠãªãã£ãŒã«ãå¹ ãšåãæ¢å®ã®æå¹æ¡æ°ã䜿çšããããã®çµæãå€ãåºå®å°æ°ç¹åœ¢åŒã§æžåŒèšå®ãããŸãã æŽæ°åã®æ¢å®ã®æå¹æ¡æ°ã¯æ¬¡ã®ãšããã§ãã
Single åãDecimal åãDouble åã®å Žå: exponent ⥠-4 ããã³ exponent< 粟床æå®åã®å Žåãå€ã¯åºå®å°æ°ç¹åœ¢åŒã§æžåŒèšå®ãããŸããããã§exponentã¯ææ°åœ¢åŒã®å€ã®ææ°ã§ãã ãã®ä»ã®ãã¹ãŠã®å€ã«ã¯ãç§åŠçãªåœ¢åŒã䜿çšãããŸãã å¿ èŠã«å¿ããŠãçµæã¯æãè¿ã衚çŸå¯èœãªå€ã«äžžããããŸãã 粟床æå®åãçç¥ãããšãæ¬¡ã®æ¢å®ã®æå¹æ¡æ°ã䜿çšãããŸãã
ãã¹ãŠã®åã®å Žå:
|
|
æ°å€åœ¢åŒ: 次ã®åœ¢åŒã®æååã«äœ¿çšãããŸãã [-]d,ddd,ddd.dd...d è² ã®å€ã®è¡šçŸã¯ã å°ãªããšã 0 以å€ã® 10 鲿° (d) ã®åã«å°æ°ç¹ ('.') ãããã 粟床æå®åã¯ãå°æ°ç¹ä»¥äžã®æ¡æ° (dd...d)ã 粟床æå®åãçç¥ãããšã |
|
ããŒã»ã³ã圢åŒ: ããŒã»ã³ããŒãžãå«ãæååã«äœ¿çšãããŸãã
æå¹æ¡æ°ãæå®ãããŠããªãå Žåãçµæã®å°æ°ç¹ä»¥äžã®æ¡æ°ã¯ çµæã¯ 100 ã§ã¹ã±ãŒãªã³ã°ãããŸã (.99 㯠99% ã«ãªããŸã)ã |
|
ã©ãŠã³ã ããªãã圢åŒ: (ãã®åœ¢åŒã¯ã System.Double ãŸã㯠System.Singleã§æå®ããå Žåã«ã®ã¿æå¹ã§ã)ãæµ®åå°æ°ç¹å€ã®æåå衚çŸã®ç²ŸåºŠããæååãè§£æããŠãå
ã®å€ãšæ¯èŒããŠã粟床ãäœäžããªãããã«ããããã«äœ¿çšãããŸãã ããŒã¿åã®æå€§æå¹æ¡æ° ( System.Singleã®å Žå㯠7ã System.Doubleã®å Žå㯠15) ã®å Žåã粟床ã¯å°æ°ç¹ä»¥äž 2 æ¡å¢å ããŸãã 粟床æå®åããã®æžåŒæå®åãšå
±ã«æå®ãããå Žåãããã¯ç¡èŠãããŸãã ãã以å€ã®å Žåããã®åœ¢åŒã¯åºå®å°æ°ç¹åœ¢åŒãšåãã§ãã |
|
16 鲿°åœ¢åŒ: (ãã®åœ¢åŒã¯æŽæ°ããŒã¿åã§æå®ãããŠããå Žåã«ã®ã¿æå¹ã§ã)ãBase 16 ã®æ°å€ã®æåå衚çŸã«äœ¿çšãããŸããæå¹æ¡æ°ã«ãã£ãŠãæååå ã®æå°æ¡æ°ã決ãŸããŸãã æå¹æ¡æ°ãæ°å€ã«å«ãŸããŠããæ¡æ°ããå€ãæå®ãããŠããå Žåãæ°å€ã¯ãŒãã§å·Šã«åã蟌ãŸããŸãã æžåŒæå®å ('X' ãŸã㯠'x') ã®å€§æåãšå°æåã®ã©ã¡ãã 16 鲿°è¡šçŸã§äœ¿çšãããããæ±ºãŸããŸãã |
æ°å€ãSystem.SingleãSystem.DoubleããŸãã¯NaNã®å€ãæã€PositiveInfinityãŸãã¯NegativeInfinityã®å ŽåãæžåŒæå®åã¯ç¡èŠãããSystem.Globalization.NumberFormatInfo.NaNSymbolãSystem.Globalization.NumberFormatInfo.PositiveInfinitySymbolããŸãã¯System.Globalization.NumberFormatInfo.NegativeInfinitySymbolã®ãããããè¿ãããŸãã
ã«ã¹ã¿ã æžåŒã¯ãäžèšã®æšæºæžåŒæå®æåå (Axx) ã®åœ¢åŒã§ã¯ãªãæžåŒãšããŠæå®ãããä»»æã®æååã§ãã æ¬¡ã®è¡šã§ã¯ãã«ã¹ã¿ã 圢åŒã®æ§ç¯ã«äœ¿çšãããæåã«ã€ããŠèª¬æããŸãã
| æžåŒæå®å | 説æ |
|---|---|
0 (ãŒã) |
ãŒã ãã¬ãŒã¹ãã«ããŒ: æžåŒèšå®äžã®å€ãã«ã¹ã¿ã 圢åŒã§ '0' ã衚瀺ãããäœçœ®ã«æ°åãããå Žåããã®æ°åã¯åºåæååã«ã³ããŒãããŸãããã以å€ã®å Žåã¯ãåºåæååå ã®ãã®äœçœ®ã« 0 ãæ ŒçŽãããŸãã å°æ°ç¹åºåãèšå·ã®åã®å·Šç«¯ã® '0' ã®äœçœ®ãããã³å°æ°ç¹åºåãèšå·ã®åŸã®å³ç«¯ã® '0' ã®äœçœ®ã«ãã£ãŠãåºåæååã«åžžã«ååšããæ¡æ°ã®ç¯å²ã決ãŸããŸãã å°æ°ç¹åºåãèšå·ã®åŸã®ãŒããŸãã¯æ°åã®ãã¬ãŒã¹ãã«ããŒã®æ°ã«ãã£ãŠãå°æ°ç¹ã®åŸã«è¡šç€ºãããæ¡æ°ã決ãŸããŸãã å€ã¯å¿ èŠã«å¿ããŠäžžããããŸãã |
# |
Digit placeholder: æžåŒèšå®ãããŠããå€ã® '#' ãã«ã¹ã¿ã 圢åŒã§è¡šç€ºãããäœçœ®ã«æ°åãããå Žåããã®æ°åã¯åºåæååã«ã³ããŒãããŸãããã以å€ã®å Žåãåºåæååå ã®ãã®äœçœ®ã«ã¯äœãæ ŒçŽãããŸããã ãã®æå®åã¯ã'0' ãæååå ã®å¯äžã®æ°åã§ããå Žåã§ããæå¹ãªæ°åã§ãªãå Žå㯠ã'0' æåãæ ŒçŽããªãããšã«æ³šæããŠãã ããã (æå¹ãªæ°åã®å Žåã¯ãåºåæååã« '0' æåã衚瀺ãããŸã)ã å°æ°ç¹åºåãèšå·ã®åŸã®ãŒããŸãã¯æ°åã®ãã¬ãŒã¹ãã«ããŒã®æ°ã«ãã£ãŠãå°æ°ç¹ã®åŸã«è¡šç€ºãããæ¡æ°ã決ãŸããŸãã å€ã¯å¿ èŠã«å¿ããŠäžžããããŸãã |
. (æé) |
å°æ°ç¹åºåãèšå·: 巊端㮠'.'
æžåŒæå®æååå
ã®æåã¯ãæžåŒèšå®ãããå€ã®å°æ°ç¹åºåãèšå·ã®äœçœ®ã決å®ããŸãã远å ã® '.' æåã¯ç¡èŠãããŸãã
System.Globalization.NumberFormatInfo.NumberDecimalSeparator ããããã£ã¯ãå°æ°ç¹åºåãèšå·ãšããŠäœ¿çšãããèšå·ã決å®ããŸãã |
, (ã³ã³ã) |
ã°ã«ãŒãåºåãèšå·ãšæ°å€ã®ã¹ã±ãŒãªã³ã°: ',' æå㯠2 ã€ã®ç®çãæãããŸãã æåã«ãã«ã¹ã¿ã 圢åŒã« 2 ã€ã®ãŒããŸãã¯æ°åã®ãã¬ãŒã¹ãã«ã㌠(0 ãŸã㯠#) ã®éã«ãã®æåãå«ãŸããŠããå Žåãå°æ°ç¹åºåãèšå·ãååšããå Žåã¯ãå°æ°ç¹åºåãèšå·ã®å·ŠåŽã«åæ¡ã®éã«ã°ã«ãŒãåºåãèšå·ãæ¿å
¥ãããŸãã
æžåŒæå®æååã«å°æ°ç¹ã®å·Šã« 1 ã€ä»¥äžã® ',' æåãå«ãŸããŠããå Žåãæ°å€ã¯æ¡å€§çž®å°ãããŸãã å°æ°ç¹ä»¥äžæ¡æ°ã¯ãå°æ°ç¹åºåãèšå·ã®ããå·Šã«ããã°ã«ãŒãåºåãæåã®æ°ã«ãã£ãŠæ±ºãŸããŸãã x æåãããå Žåãå€ã¯æžåŒèšå®ãããåã« 1000X ã§é€ç®ãããŸãã ããšãã°ãæžåŒæå®æåå '0,' ã¯å€ã 100 äžã§é€ç®ããŸãã ã¹ã±ãŒãªã³ã°ã瀺ã ',' æåãååšããŠããåºåæååã«ã°ã«ãŒãåºåãèšå·ã¯æ¿å ¥ãããªãããšã«æ³šæããŠãã ããã ãããã£ãŠãæ°å€ã 100 äžåäœã§ã¹ã±ãŒãªã³ã°ããã°ã«ãŒãåºåãèšå·ãæ¿å ¥ããã«ã¯ã'#,##0,' ã®ãããªã«ã¹ã¿ã 圢åŒã䜿çšããŸãã |
% (ããŒã»ã³ã) |
ããŒã»ã³ããŒãž ãã¬ãŒã¹ãã«ããŒ: ã«ã¹ã¿ã 圢åŒã® '%' æåãååšãããšãæžåŒèšå®ãããåã«æ°å€ã« 100 ãä¹ç®ãããŸãã ããŒã»ã³ãèšå·ã¯ãæžåŒæå®æååã® '%' ã衚瀺ãããå Žæã®åºåæååã«æ¿å
¥ãããŸãã
System.Globalization.NumberFormatInfo.PercentSymbolããããã£ã¯ãããŒã»ã³ãèšå·ã決å®ããŸãã |
|
ãšã³ãžãã¢ãªã³ã°åœ¢åŒ: æåå 'E'ã'E+'ã'E'ã'e'ã'e+'ããŸã㯠'e-' ã®ãããããã«ã¹ã¿ã 圢åŒã§ååšãããã®çŽåŸã«å°ãªããšã 1 ã€ã® '0' æåãç¶ãå Žåãå€ã¯ç§åŠç衚èšã䜿çšããŠæžåŒèšå®ãããŸãã ææ°ãã¬ãã£ãã¯ã¹ (E ãŸã㯠e) ã®åŸã«ç¶ã '0' æåã®æ°ã«ãã£ãŠãææ°ã®æå°æ¡æ°ã決ãŸããŸãã 'E+' 圢åŒãš 'e+' 圢åŒã¯ãæ£ãŸãã¯è² ã®æ°å€èšå·ãåžžã«ææ°ã®åã«ããããšã瀺ããŸãã 'E'ã'E'ã'e'ããŸã㯠'e-' 圢åŒã¯ãè² ã®æ°ã®èšå·ãè² ã®ææ°ã®åã«ããããšã瀺ããŸããæ£ã®ææ°ã®åã«èšå·ããããŸããã æ£ã®æ°å€èšå·ã¯ã System.Globalization.NumberFormatInfo.PositiveSign ããããã£ã«ãã£ãŠæå®ãããŸãã è² ã®æ°ã®èšå·ã¯ã System.Globalization.NumberFormatInfo.NegativeSign ããããã£ã«ãã£ãŠæå®ãããŸãã |
\ (åèšå·) |
ãšã¹ã±ãŒãæå: C# ãªã©ã®äžéšã®èšèªã§ã¯ãåèšå·æåã«ãã£ãŠãã«ã¹ã¿ã 圢åŒã®æ¬¡ã®æåããšã¹ã±ãŒã ã·ãŒã±ã³ã¹ãšããŠè§£éãããŸãã ããã¯ã'\n' (æ¹è¡) ãªã©ã® C èšèªã®æžåŒèšå®ã·ãŒã±ã³ã¹ã§äœ¿çšãããŸãã äžéšã®èšèªã§ã¯ããªãã©ã«ãšããŠäœ¿çšããå Žåããšã¹ã±ãŒãæåèªäœã®åã«ãšã¹ã±ãŒãæåãä»ããå¿ èŠããããŸãã ãã以å€ã®å Žåãã³ã³ãã€ã©ã¯æåããšã¹ã±ãŒã ã·ãŒã±ã³ã¹ãšããŠè§£éããŸãã ãã®ãšã¹ã±ãŒãæåã¯ããã¹ãŠã®ããã°ã©ãã³ã°èšèªã§ãµããŒããããŠããå¿ èŠã¯ãããŸããã |
|
ãªãã©ã«æåå: åäžåŒçšç¬ŠãŸãã¯äºéåŒçšç¬Šã§å²ãŸããæåã¯ããªãã©ã«åœ¢åŒã§åºåæååã«ã³ããŒãããæžåŒèšå®ã«ã¯åœ±é¿ããŸããã |
; (ã»ãã³ãã³) |
ã»ã¯ã·ã§ã³åºåãèšå·: ';' æåã¯ãæžåŒæå®æååå ã®æ£ãè² ãããã³ãŒãã®æ°å€ã®ã»ã¯ã·ã§ã³ãåºåãããã«äœ¿çšãããŸãã (ãã®æ©èœã«ã€ããŠã¯ã以äžã§è©³ãã説æããŸã)ã |
| ãã®ä» | ãã®ä»ã®ãã¹ãŠã®æå: ä»ã®ãã¹ãŠã®æåã¯ã衚瀺ãããäœçœ®ã®ãªãã©ã«ãšããŠåºåæååã«æ ŒçŽãããŸãã |
åºå®å°æ°ç¹æžåŒæå®æåå ('E0'ã'E+0'ã'E-0'ã'e0'ã'e+0'ããŸã㯠'e-0' ãå«ãŸãªãæåå) ã®å Žåãå°æ°ç¹åºåãèšå·ã®å³åŽã«ãŒããŸãã¯æ¡ã®ãã¬ãŒã¹ãã«ããŒãããæ°ã®å°æ°ç¹ä»¥äžã«æ°å€ãäžžããããŸãã ãŠãŒã¶ãŒèšå®ã®æžåŒã«å°æ°ç¹ãå«ãŸããŠããªãå Žåãæ°å€ã¯æãè¿ãæŽæ°ã«äžžããããŸãã æ°å€ã®æ¡æ°ããå°æ°ç¹ã®å·ŠåŽã«ãŒããŸãã¯æ°åã®ãã¬ãŒã¹ãã«ããŒãããå€ãå Žåãäœåãªæ°åã¯ãæåã®ãŒããŸãã¯æ°åã®ãã¬ãŒã¹ãã«ããŒã®çŽåã®åºåæååã«ã³ããŒãããŸãã
ã«ã¹ã¿ã æžåŒã«ã¯ãã»ã¯ã·ã§ã³åºåãæåã§åºåãããæå€§ 3 ã€ã®ã»ã¯ã·ã§ã³ãå«ããããšãã§ããŸããæ£ãè² ããŒãã®å€ã«ç°ãªãæžåŒãæå®ã§ããŸãã ã»ã¯ã·ã§ã³ã¯æ¬¡ã®ããã«è§£éãããŸãã
1 ã€ã®ã»ã¯ã·ã§ã³: ã«ã¹ã¿ã 圢åŒã¯ãã¹ãŠã®å€ (æ£ãè² ããŒã) ã«é©çšãããŸãã è² ã®å€ã«ã¯è² ã®ç¬Šå·ãå«ãŸããŸãã
2 ã€ã®ã»ã¯ã·ã§ã³: æåã®ã»ã¯ã·ã§ã³ã¯æ£ã®å€ãš 0 ã«é©çšããã2 çªç®ã®ã»ã¯ã·ã§ã³ã¯è² ã®å€ã«é©çšãããŸãã æžåŒèšå®ããå€ãè² ã®å€ã§ã2 çªç®ã®ã»ã¯ã·ã§ã³ã®æžåŒã«åŸã£ãŠäžžããåŸã« 0 ã«ãªãå Žåãçµæã® 0 ã¯æåã®ã»ã¯ã·ã§ã³ã«åŸã£ãŠæžåŒèšå®ãããŸãã è² ã®å€ã«ã¯ãè² ã®å€ã®è¡šçŸãå®å šã«å¶åŸ¡ããããã®è² ã®ç¬Šå·ã¯å«ãŸããŸããã ããšãã°ãè² ã®å€ã¯ã'####.# ã®ãããªã«ã¹ã¿ã 圢åŒã䜿çšããŠãã£ãã§è¡šãããšãã§ããŸãã(####.####)â.
3 ã€ã®ã»ã¯ã·ã§ã³: æåã®ã»ã¯ã·ã§ã³ã¯æ£ã®å€ã«é©çšããã2 çªç®ã®ã»ã¯ã·ã§ã³ã¯è² ã®å€ã«é©çšããã3 çªç®ã®ã»ã¯ã·ã§ã³ã¯ãŒãã«é©çšãããŸãã 2 çªç®ã®ã»ã¯ã·ã§ã³ã¯ç©ºã«ããããšãã§ããŸã (ã»ãã³ãã³ã®éã«ã¯äœã衚瀺ãããŸãã)ããã®å Žåãæåã®ã»ã¯ã·ã§ã³ã¯ãã¹ãŠã® 0 以å€ã®å€ã«é©çšãããè² ã®å€ã«ã¯è² ã®ç¬Šå·ãå«ãŸããŸãã æžåŒèšå®ããæ°å€ã 0 以å€ã§ã1 çªç®ãŸã㯠2 çªç®ã®ã»ã¯ã·ã§ã³ã®æžåŒã«åŸã£ãŠäžžããåŸã« 0 ã«ãªãå Žåãçµæã® 0 㯠3 çªç®ã®ã»ã¯ã·ã§ã³ã«åŸã£ãŠæžåŒèšå®ãããŸãã
System.EnumåãšSystem.DateTimeåã§ã¯ãæžåŒæå®åã䜿çšããŠå€ã®æåå圢åŒãæžåŒèšå®ããããšãã§ããŸãã ç¹å®ã®æžåŒæå®åã®æå³ã¯ãæžåŒèšå®ãããããŒã¿ã®çš®é¡ (æ°å€ãæ¥ä»/æå»ãåæ) ã«ãã£ãŠç°ãªããŸãã ååã§ãµããŒããããŠããæžåŒæå®åã®å
æ¬çãªäžèЧã«ã€ããŠã¯ã System.Enum ãš System.Globalization.DateTimeFormatInfo ãåç
§ããŠãã ããã
C.5 ã©ã€ãã©ãªã®çš®é¡ã®çç¥åœ¢
ãã®ä»æ§ã§ã¯ã次ã®ã©ã€ãã©ãªã®çš®é¡ãåç
§ãããŠããŸãã ã°ããŒãã«åå空é修食åãå«ãããããã®åã®å®å
šãªååãæ¬¡ã«ç€ºããŸãã ãã®ä»æ§ã§ã¯ããããã®åã¯å®å
šä¿®é£ŸåãšããŠè¡šç€ºãããŸããã°ããŒãã«åå空é修食åãçç¥ããå ŽåããŸãã¯åçŽãªé修食ååãšããŠãåå空éãçç¥ããŸãã ããšãã°ããã®ä»æ§ã§äœ¿çšããå Žåãå ICollection<T>ã¯åžžã«å global::System.Collections.Generic.ICollection<T>ãæå³ããŸãã
global::System.Actionglobal::System.ArgumentExceptionglobal::System.ArgumentOutOfRangeExceptionglobal::System.ArithmeticExceptionglobal::System.Arrayglobal::System.ArrayTypeMismatchExceptionglobal::System.Attributeglobal::System.AttributeTargetsglobal::System.AttributeUsageAttributeglobal::System.Booleanglobal::System.Byteglobal::System.Charglobal::System.Decimalglobal::System.Delegateglobal::System.DivideByZeroExceptionglobal::System.Doubleglobal::System.Enumglobal::System.Exceptionglobal::System.FormattableStringglobal::System.GCglobal::System.IAsyncDisposableglobal::System.IDisposableglobal::System.IEquatable<T>global::System.IFormattableglobal::System.Indexglobal::System.IndexOutOfRangeExceptionglobal::System.Int16global::System.Int32global::System.Int64global::System.IntPtrglobal::System.InvalidCastExceptionglobal::System.InvalidOperationExceptionglobal::System.MemoryExtensionsglobal::System.NotSupportedExceptionglobal::System.Nullable<T>global::System.NullReferenceExceptionglobal::System.Objectglobal::System.ObsoleteAttributeglobal::System.OperationCanceledExceptionglobal::System.OutOfMemoryExceptionglobal::System.OverflowExceptionglobal::System.Rangeglobal::System.ReadOnlySpanglobal::System.SByteglobal::System.Singleglobal::System.Spanglobal::System.StackOverflowExceptionglobal::System.Stringglobal::System.SystemExceptionglobal::System.Typeglobal::System.TypeInitializationExceptionglobal::System.UInt16global::System.UInt32global::System.UInt64global::System.UIntPtrglobal::System.ValueTuple<T1>global::System.ValueTuple<T1, T2>global::System.ValueTuple<T1, T2, T3>global::System.ValueTuple<T1, T2, T3, T4>global::System.ValueTuple<T1, T2, T3, T4, T5>global::System.ValueTuple<T1, T2, T3, T4, T5, T6>global::System.ValueTuple<T1, T2, T3, T4, T5, T6, T7>global::System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>global::System.ValueTypeglobal::System.Collections.ICollectionglobal::System.Collections.IEnumerableglobal::System.Collections.IEnumeratorglobal::System.Collections.IListglobal::System.Collections.Generic.IAsyncEnumerable<out T>global::System.Collections.Generic.IAsyncEnumerator<out T>global::System.Collections.Generic.ICollection<T>global::System.Collections.Generic.IEnumerable<T>global::System.Collections.Generic.IEnumerator<T>global::System.Collections.Generic.IList<T>global::System.Collections.Generic.IReadOnlyCollection<out T>global::System.Collections.Generic.IReadOnlyList<out T>global::System.Diagnostics.ConditionalAttributeglobal::System.Diagnostics.CodeAnalysis.AllowNullAttributeglobal::System.Diagnostics.CodeAnalysis.DisallowNullAttributeglobal::System.Diagnostics.CodeAnalysis.DoesNotReturnAttributeglobal::System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttributeglobal::System.Diagnostics.CodeAnalysis.MaybeNullAttributeglobal::System.Diagnostics.CodeAnalysis.MaybeNullWhenAttributeglobal::System.Diagnostics.CodeAnalysis.MemberNotNullAttributeglobal::System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttributeglobal::System.Diagnostics.CodeAnalysis.NotNullAttributeglobal::System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttributeglobal::System.Diagnostics.CodeAnalysis.NotNullWhenAttributeglobal::System.Diagnostics.CodeAnalysis.UnscopedRefAttributeglobal::System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttributeglobal::System.Linq.Expressions.Expression<TDelegate>global::System.Reflection.MemberInfoglobal::System.Runtime.CompilerServices.AsyncMethodBuilderAttributeglobal::System.Runtime.CompilerServices.CallerArgumentExpressionAttributeglobal::System.Runtime.CompilerServices.CallerFilePathAttributeglobal::System.Runtime.CompilerServices.CallerLineNumberAttributeglobal::System.Runtime.CompilerServices.CallerMemberNameAttributeglobal::System.Runtime.CompilerServices.CollectionBuilderAttributeglobal::System.Runtime.CompilerServices.DefaultInterpolatedStringHandlerglobal::System.Runtime.CompilerServices.FormattableStringFactoryglobal::System.Runtime.CompilerServices.ICriticalNotifyCompletionglobal::System.Runtime.CompilerServices.IndexerNameAttributeglobal::System.Runtime.CompilerServices.InlineArrayAttributeglobal::System.Runtime.CompilerServices.INotifyCompletionglobal::System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttributeglobal::System.Runtime.CompilerServices.InterpolatedStringHandlerAttributeglobal::System.Runtime.CompilerServices.ITupleglobal::System.Runtime.CompilerServices.ModuleInitializerAttributeglobal::System.Runtime.CompilerServices.OverloadResolutionPriorityAttributeglobal::System.Runtime.CompilerServices.RequiredMemberAttributeglobal::System.Runtime.CompilerServices.TaskAwaiterglobal::System.Runtime.CompilerServices.TaskAwaiter<TResult>global::System.Runtime.CompilerServices.ValueTaskAwaiterglobal::System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>global::System.Runtime.CompilerServices.Unsafeglobal::System.Runtime.InteropServices.UnmanagedCallersOnlyAttributeglobal::System.Threading.Lockglobal::System.Threading.Lock.Scopeglobal::System.Threading.Monitorglobal::System.Threading.Tasks.Taskglobal::System.Threading.Tasks.Task<TResult>
æ å ±ããã¹ãã®æ«å°Ÿã
ECMA C# draft specification