TValue IDictionary<TKey, TValue>.this[TKey key]
{
- get
- {
- return m_dictionary[key];
- }
- set
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
+ get => m_dictionary[key];
+ set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
#endregion
}
return null;
}
- set
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
+ set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
void ICollection.CopyTo(Array array, int index)
public bool InitLocals
{
- get { return m_methodBuilder.InitLocals; }
- set { m_methodBuilder.InitLocals = value; }
+ get => m_methodBuilder.InitLocals;
+ set => m_methodBuilder.InitLocals = value;
}
#endregion
public bool InitLocals
{
- get { return m_fInitLocals; }
- set { m_fInitLocals = value; }
+ get => m_fInitLocals;
+ set => m_fInitLocals = value;
}
//
other.m_kind == m_kind;
}
- public static bool operator ==(ExceptionHandler left, ExceptionHandler right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(ExceptionHandler left, ExceptionHandler right) => left.Equals(right);
- public static bool operator !=(ExceptionHandler left, ExceptionHandler right)
- {
- return !left.Equals(right);
- }
+ public static bool operator !=(ExceptionHandler left, ExceptionHandler right) => !left.Equals(right);
#endregion
}
internal INVOCATION_FLAGS InvocationFlags
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return (m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) != 0 ?
+ get => (m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) != 0 ?
m_invocationFlags : InitializeInvocationFlags();
- }
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override Type FieldType
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return m_fieldType ?? InitializeFieldType();
- }
+ get => m_fieldType ?? InitializeFieldType();
}
[MethodImpl(MethodImplOptions.NoInlining)]
// This offset is baked in by string indexer intrinsic, so there is no harm
// in getting it baked in here as well.
[System.Runtime.Versioning.NonVersionable]
- get
- {
+ get =>
// Number of bytes from the address pointed to by a reference to
// a String to the first 16-bit character in the String. Skip
// over the MethodTable pointer, & String
// This property allows C#'s fixed statement to work on Strings.
// On 64 bit platforms, this should be 12 (8+4) and on 32 bit 8 (4+4).
#if BIT64
- return 12;
+ 12;
#else // 32
- return 8;
+ 8;
#endif // BIT64
- }
+
}
// This method ensures that there is sufficient stack to execute the average Framework function.
//
object? IList.this[int index]
{
- get
- {
- return _list[index];
- }
-
- set
- {
- _list[index] = value;
- }
+ get => _list[index];
+ set => _list[index] = value;
}
int IList.Add(object? value)
// in this table. If the property is set, the new value will replace any existing token registrations.
public T? InvocationList
{
- get
- {
- return m_invokeList;
- }
+ get => m_invokeList;
set
{
lock (m_tokens)
return type;
}
- public static bool operator ==(RuntimeTypeHandle left, object? right) { return left.Equals(right); }
+ public static bool operator ==(RuntimeTypeHandle left, object? right) => left.Equals(right);
- public static bool operator ==(object? left, RuntimeTypeHandle right) { return right.Equals(left); }
+ public static bool operator ==(object? left, RuntimeTypeHandle right) => right.Equals(left);
- public static bool operator !=(RuntimeTypeHandle left, object? right) { return !left.Equals(right); }
+ public static bool operator !=(RuntimeTypeHandle left, object? right) => !left.Equals(right);
- public static bool operator !=(object? left, RuntimeTypeHandle right) { return !right.Equals(left); }
+ public static bool operator !=(object? left, RuntimeTypeHandle right) => !right.Equals(left);
// This is the RuntimeType for the type
return handle.Value == Value;
}
- public static bool operator ==(RuntimeMethodHandle left, RuntimeMethodHandle right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(RuntimeMethodHandle left, RuntimeMethodHandle right) => left.Equals(right);
- public static bool operator !=(RuntimeMethodHandle left, RuntimeMethodHandle right)
- {
- return !left.Equals(right);
- }
+ public static bool operator !=(RuntimeMethodHandle left, RuntimeMethodHandle right) => !left.Equals(right);
public bool Equals(RuntimeMethodHandle handle)
{
return handle.Value == Value;
}
- public static bool operator ==(RuntimeFieldHandle left, RuntimeFieldHandle right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(RuntimeFieldHandle left, RuntimeFieldHandle right) => left.Equals(right);
- public static bool operator !=(RuntimeFieldHandle left, RuntimeFieldHandle right)
- {
- return !left.Equals(right);
- }
+ public static bool operator !=(RuntimeFieldHandle left, RuntimeFieldHandle right) => !left.Equals(right);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern string GetName(RtFieldInfo field);
return handle.m_ptr == m_ptr;
}
- public static bool operator ==(ModuleHandle left, ModuleHandle right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(ModuleHandle left, ModuleHandle right) => left.Equals(right);
- public static bool operator !=(ModuleHandle left, ModuleHandle right)
- {
- return !left.Equals(right);
- }
+ public static bool operator !=(ModuleHandle left, ModuleHandle right) => !left.Equals(right);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern IRuntimeMethodInfo GetDynamicMethod(System.Reflection.Emit.DynamicMethod method, RuntimeModule module, string name, byte[] sig, Resolver resolver);
public IAsyncResult? AsyncResult
{
- get { return _overlappedData!._asyncResult; }
- set { _overlappedData!._asyncResult = value; }
+ get => _overlappedData!._asyncResult;
+ set => _overlappedData!._asyncResult = value;
}
public int OffsetLow
{
- get { return _overlappedData!.OffsetLow; }
- set { _overlappedData!.OffsetLow = value; }
+ get => _overlappedData!.OffsetLow;
+ set => _overlappedData!.OffsetLow = value;
}
public int OffsetHigh
{
- get { return _overlappedData!.OffsetHigh; }
- set { _overlappedData!.OffsetHigh = value; }
+ get => _overlappedData!.OffsetHigh;
+ set => _overlappedData!.OffsetHigh = value;
}
[Obsolete("This property is not 64-bit compatible. Use EventHandleIntPtr instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public int EventHandle
{
- get { return EventHandleIntPtr.ToInt32(); }
- set { EventHandleIntPtr = new IntPtr(value); }
+ get => EventHandleIntPtr.ToInt32();
+ set => EventHandleIntPtr = new IntPtr(value);
}
public IntPtr EventHandleIntPtr
{
- get { return _overlappedData!.EventHandle; }
- set { _overlappedData!.EventHandle = value; }
+ get => _overlappedData!.EventHandle;
+ set => _overlappedData!.EventHandle = value;
}
/*====================================================================
namespace Internal.Threading.Tasks
{
- //
- // An internal contract that exposes just enough async debugger support needed by the AsTask() extension methods in the WindowsRuntimeSystemExtensions class.
- //
+ /// <summary>Internal contract exposing just enough async debugger support needed by the AsTask() extension methods in the WindowsRuntimeSystemExtensions class.</summary>
public static class AsyncCausalitySupport
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool LoggingOn
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return AsyncCausalityTracer.LoggingOn;
- }
+ get => AsyncCausalityTracer.LoggingOn;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void TraceOperationCreation(Task task, string operationName)
- {
+ public static void TraceOperationCreation(Task task, string operationName) =>
AsyncCausalityTracer.TraceOperationCreation(task, operationName);
- }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void TraceOperationCompletedSuccess(Task task)
- {
+ public static void TraceOperationCompletedSuccess(Task task) =>
AsyncCausalityTracer.TraceOperationCompletion(task, AsyncCausalityStatus.Completed);
- }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void TraceOperationCompletedError(Task task)
- {
+ public static void TraceOperationCompletedError(Task task) =>
AsyncCausalityTracer.TraceOperationCompletion(task, AsyncCausalityStatus.Error);
- }
}
}
internal bool? IsAsync
{
- get
- {
- return _isAsync;
- }
-
- set
- {
- _isAsync = value;
- }
+ get => _isAsync;
+ set => _isAsync = value;
}
internal ThreadPoolBoundHandle? ThreadPoolBinding { get; set; }
- protected override bool ReleaseHandle()
- {
- return Interop.Kernel32.CloseHandle(handle);
- }
+ protected override bool ReleaseHandle() =>
+ Interop.Kernel32.CloseHandle(handle);
}
}
public static bool MonitoringIsEnabled
{
- get { return true; }
+ get => true;
set
{
if (!value)
object? IList.this[int index]
{
- get { return GetValue(index); }
- set { SetValue(value, index); }
+ get => GetValue(index);
+ set => SetValue(value, index);
}
int IList.Add(object? value)
{
_attributeTarget = validOn;
}
+
internal AttributeUsageAttribute(AttributeTargets validOn, bool allowMultiple, bool inherited)
{
_attributeTarget = validOn;
public bool AllowMultiple
{
- get { return _allowMultiple; }
- set { _allowMultiple = value; }
+ get => _allowMultiple;
+ set => _allowMultiple = value;
}
public bool Inherited
{
- get { return _inherited; }
- set { _inherited = value; }
+ get => _inherited;
+ set => _inherited = value;
}
}
}
public ref T Value
{
+ // Implemented as a JIT intrinsic - This default implementation is for
+ // completeness and to provide a concrete error if called via reflection
+ // or if the intrinsic is missed.
[Intrinsic]
- get
- {
- // Implemented as a JIT intrinsic - This default implementation is for
- // completeness and to provide a concrete error if called via reflection
- // or if the intrinsic is missed.
- throw new PlatformNotSupportedException();
- }
+ get => throw new PlatformNotSupportedException();
}
}
}
//
public virtual int Capacity
{
- get
- {
- return _items.Length;
- }
+ get => _items.Length;
set
{
if (value < _size)
public override int Capacity
{
- get { return _list.Count; }
+ get => _list.Count;
set
{
if (value < Count) throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
public override object? this[int index]
{
- get
- {
- return _list[index];
- }
+ get => _list[index];
set
{
_list[index] = value;
public virtual object? this[int index]
{
- get
- {
- return _list[index];
- }
- set
- {
- _list[index] = value;
- }
+ get => _list[index];
+ set => _list[index] = value;
}
public virtual object SyncRoot => _list.SyncRoot;
public override object? this[int index]
{
- get
- {
- return _list[index];
- }
+ get => _list[index];
set
{
_list[index] = value;
public override int Capacity
{
- get { return _list.Capacity; }
+ get => _list.Capacity;
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- set
- { throw new NotSupportedException(SR.NotSupported_FixedSizeCollection); }
+ set => throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
public override void Clear()
public virtual object? this[int index]
{
- get
- {
- return _list[index];
- }
- set
- {
- throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
- }
+ get => _list[index];
+ set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public virtual object SyncRoot => _list.SyncRoot;
public override object? this[int index]
{
- get
- {
- return _list[index];
- }
- set
- {
- throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
- }
+ get => _list[index];
+ set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public override object SyncRoot => _list.SyncRoot;
public override int Capacity
{
- get { return _list.Capacity; }
+ get => _list.Capacity;
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- set
- { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
+ set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public override void Clear()
public override int Capacity
{
- get
- {
- return _baseList.Capacity;
- }
+ get => _baseList.Capacity;
set
{
public object Key
{
- get
- {
- return _key;
- }
-
- set
- {
- _key = value;
- }
+ get => _key;
+ set => _key = value;
}
public object? Value
{
- get
- {
- return _value;
- }
-
- set
- {
- _value = value;
- }
+ get => _value;
+ set => _value = value;
}
[EditorBrowsable(EditorBrowsableState.Never)]
//
public int Capacity
{
- get
- {
- return _items.Length;
- }
+ get => _items.Length;
set
{
if (value < _size)
object? IList.this[int index]
{
- get
- {
- return this[index];
- }
+ get => this[index];
set
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(value, ExceptionArgument.value);
return null;
}
- set
- {
- Insert(key, value, false);
- }
+ set => Insert(key, value, false);
}
// Increases the bucket count of this hashtable. This method is called from
public override object? this[object key]
{
- get
- {
- return _table[key];
- }
+ get => _table[key];
set
{
lock (_table.SyncRoot)
public T this[int index]
{
- get { return items[index]; }
+ get => items[index];
set
{
if (items.IsReadOnly)
object? IList.this[int index]
{
- get { return items[index]; }
+ get => items[index];
set
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(value, ExceptionArgument.value);
T IList<T>.this[int index]
{
- get { return list[index]; }
- set
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
+ get => list[index];
+ set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
void ICollection<T>.Add(T value)
object? IList.this[int index]
{
- get { return list[index]; }
- set
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
+ get => list[index];
+ set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
int IList.Add(object? value)
return new DateTime((ulong)(ticks - valueTicks) | d.InternalKind);
}
- public static TimeSpan operator -(DateTime d1, DateTime d2)
- {
- return new TimeSpan(d1.InternalTicks - d2.InternalTicks);
- }
+ public static TimeSpan operator -(DateTime d1, DateTime d2) => new TimeSpan(d1.InternalTicks - d2.InternalTicks);
- public static bool operator ==(DateTime d1, DateTime d2)
- {
- return d1.InternalTicks == d2.InternalTicks;
- }
+ public static bool operator ==(DateTime d1, DateTime d2) => d1.InternalTicks == d2.InternalTicks;
- public static bool operator !=(DateTime d1, DateTime d2)
- {
- return d1.InternalTicks != d2.InternalTicks;
- }
+ public static bool operator !=(DateTime d1, DateTime d2) => d1.InternalTicks != d2.InternalTicks;
- public static bool operator <(DateTime t1, DateTime t2)
- {
- return t1.InternalTicks < t2.InternalTicks;
- }
+ public static bool operator <(DateTime t1, DateTime t2) => t1.InternalTicks < t2.InternalTicks;
- public static bool operator <=(DateTime t1, DateTime t2)
- {
- return t1.InternalTicks <= t2.InternalTicks;
- }
+ public static bool operator <=(DateTime t1, DateTime t2) => t1.InternalTicks <= t2.InternalTicks;
- public static bool operator >(DateTime t1, DateTime t2)
- {
- return t1.InternalTicks > t2.InternalTicks;
- }
+ public static bool operator >(DateTime t1, DateTime t2) => t1.InternalTicks > t2.InternalTicks;
- public static bool operator >=(DateTime t1, DateTime t2)
- {
- return t1.InternalTicks >= t2.InternalTicks;
- }
+ public static bool operator >=(DateTime t1, DateTime t2) => t1.InternalTicks >= t2.InternalTicks;
// Returns a string array containing all of the known date and time options for the
// Operators
- public static implicit operator DateTimeOffset(DateTime dateTime)
- {
- return new DateTimeOffset(dateTime);
- }
+ public static implicit operator DateTimeOffset(DateTime dateTime) =>
+ new DateTimeOffset(dateTime);
- public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan)
- {
- return new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset);
- }
+ public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
+ new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset);
- public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan)
- {
- return new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset);
- }
+ public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
+ new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset);
- public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime - right.UtcDateTime;
- }
+ public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime - right.UtcDateTime;
- public static bool operator ==(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime == right.UtcDateTime;
- }
+ public static bool operator ==(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime == right.UtcDateTime;
- public static bool operator !=(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime != right.UtcDateTime;
- }
+ public static bool operator !=(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime != right.UtcDateTime;
- public static bool operator <(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime < right.UtcDateTime;
- }
+ public static bool operator <(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime < right.UtcDateTime;
- public static bool operator <=(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime <= right.UtcDateTime;
- }
+ public static bool operator <=(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime <= right.UtcDateTime;
- public static bool operator >(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime > right.UtcDateTime;
- }
+ public static bool operator >(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime > right.UtcDateTime;
- public static bool operator >=(DateTimeOffset left, DateTimeOffset right)
- {
- return left.UtcDateTime >= right.UtcDateTime;
- }
+ public static bool operator >=(DateTimeOffset left, DateTimeOffset right) =>
+ left.UtcDateTime >= right.UtcDateTime;
}
}
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToZero);
}
- public static implicit operator decimal(byte value)
- {
- return new decimal((uint)value);
- }
+ public static implicit operator decimal(byte value) => new decimal((uint)value);
[CLSCompliant(false)]
- public static implicit operator decimal(sbyte value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(sbyte value) => new decimal(value);
- public static implicit operator decimal(short value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(short value) => new decimal(value);
[CLSCompliant(false)]
- public static implicit operator decimal(ushort value)
- {
- return new decimal((uint)value);
- }
+ public static implicit operator decimal(ushort value) => new decimal((uint)value);
- public static implicit operator decimal(char value)
- {
- return new decimal((uint)value);
- }
+ public static implicit operator decimal(char value) => new decimal((uint)value);
- public static implicit operator decimal(int value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(int value) => new decimal(value);
[CLSCompliant(false)]
- public static implicit operator decimal(uint value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(uint value) => new decimal(value);
- public static implicit operator decimal(long value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(long value) => new decimal(value);
[CLSCompliant(false)]
- public static implicit operator decimal(ulong value)
- {
- return new decimal(value);
- }
+ public static implicit operator decimal(ulong value) => new decimal(value);
- public static explicit operator decimal(float value)
- {
- return new decimal(value);
- }
+ public static explicit operator decimal(float value) => new decimal(value);
- public static explicit operator decimal(double value)
- {
- return new decimal(value);
- }
+ public static explicit operator decimal(double value) => new decimal(value);
- public static explicit operator byte(decimal value)
- {
- return ToByte(value);
- }
+ public static explicit operator byte(decimal value) => ToByte(value);
[CLSCompliant(false)]
- public static explicit operator sbyte(decimal value)
- {
- return ToSByte(value);
- }
+ public static explicit operator sbyte(decimal value) => ToSByte(value);
public static explicit operator char(decimal value)
{
return (char)temp;
}
- public static explicit operator short(decimal value)
- {
- return ToInt16(value);
- }
+ public static explicit operator short(decimal value) => ToInt16(value);
[CLSCompliant(false)]
- public static explicit operator ushort(decimal value)
- {
- return ToUInt16(value);
- }
+ public static explicit operator ushort(decimal value) => ToUInt16(value);
- public static explicit operator int(decimal value)
- {
- return ToInt32(value);
- }
+ public static explicit operator int(decimal value) => ToInt32(value);
[CLSCompliant(false)]
- public static explicit operator uint(decimal value)
- {
- return ToUInt32(value);
- }
+ public static explicit operator uint(decimal value) => ToUInt32(value);
- public static explicit operator long(decimal value)
- {
- return ToInt64(value);
- }
+ public static explicit operator long(decimal value) => ToInt64(value);
[CLSCompliant(false)]
- public static explicit operator ulong(decimal value)
- {
- return ToUInt64(value);
- }
+ public static explicit operator ulong(decimal value) => ToUInt64(value);
- public static explicit operator float(decimal value)
- {
- return ToSingle(value);
- }
+ public static explicit operator float(decimal value) => ToSingle(value);
- public static explicit operator double(decimal value)
- {
- return ToDouble(value);
- }
+ public static explicit operator double(decimal value) => ToDouble(value);
- public static decimal operator +(decimal d)
- {
- return d;
- }
+ public static decimal operator +(decimal d) => d;
- public static decimal operator -(decimal d)
- {
- return new decimal(in d, d.flags ^ SignMask);
- }
+ public static decimal operator -(decimal d) => new decimal(in d, d.flags ^ SignMask);
- public static decimal operator ++(decimal d)
- {
- return Add(d, One);
- }
+ public static decimal operator ++(decimal d) => Add(d, One);
- public static decimal operator --(decimal d)
- {
- return Subtract(d, One);
- }
+ public static decimal operator --(decimal d) => Subtract(d, One);
public static decimal operator +(decimal d1, decimal d2)
{
return d1;
}
- public static bool operator ==(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) == 0;
- }
+ public static bool operator ==(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) == 0;
- public static bool operator !=(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) != 0;
- }
+ public static bool operator !=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) != 0;
- public static bool operator <(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) < 0;
- }
+ public static bool operator <(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) < 0;
- public static bool operator <=(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) <= 0;
- }
+ public static bool operator <=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) <= 0;
- public static bool operator >(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) > 0;
- }
+ public static bool operator >(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) > 0;
- public static bool operator >=(decimal d1, decimal d2)
- {
- return DecCalc.VarDecCmp(in d1, in d2) >= 0;
- }
+ public static bool operator >=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) >= 0;
//
// IConvertible implementation
return Interlocked.Exchange(ref s_provider, provider);
}
- public static bool AutoFlush { get { return true; } set { } }
+ public static bool AutoFlush
+ {
+ get => true;
+ set { }
+ }
[ThreadStatic]
private static int t_indentLevel;
public static int IndentLevel
{
- get
- {
- return t_indentLevel;
- }
+ get => t_indentLevel;
set
{
t_indentLevel = value < 0 ? 0 : value;
private static volatile int s_indentSize = 4;
public static int IndentSize
{
- get
- {
- return s_indentSize;
- }
+ get => s_indentSize;
set
{
s_indentSize = value < 0 ? 0 : value;
public static void Flush() { }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Indent()
- {
+ public static void Indent() =>
IndentLevel++;
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Unindent()
- {
+ public static void Unindent() =>
IndentLevel--;
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Print(string? message)
- {
+ public static void Print(string? message) =>
WriteLine(message);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Print(string format, params object?[] args)
- {
+ public static void Print(string format, params object?[] args) =>
WriteLine(string.Format(null, format, args));
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Assert([DoesNotReturnIf(false)] bool condition)
- {
+ public static void Assert([DoesNotReturnIf(false)] bool condition) =>
Assert(condition, string.Empty, string.Empty);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Assert([DoesNotReturnIf(false)] bool condition, string? message)
- {
+ public static void Assert([DoesNotReturnIf(false)] bool condition, string? message) =>
Assert(condition, message, string.Empty);
- }
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert([DoesNotReturnIf(false)] bool condition, string? message, string? detailMessage)
[System.Diagnostics.Conditional("DEBUG")]
[DoesNotReturn]
- public static void Fail(string? message)
- {
+ public static void Fail(string? message) =>
Fail(message, string.Empty);
- }
[System.Diagnostics.Conditional("DEBUG")]
[DoesNotReturn]
- public static void Fail(string? message, string? detailMessage)
- {
+ public static void Fail(string? message, string? detailMessage) =>
s_provider.Fail(message, detailMessage);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Assert([DoesNotReturnIf(false)] bool condition, string? message, string detailMessageFormat, params object?[] args)
- {
+ public static void Assert([DoesNotReturnIf(false)] bool condition, string? message, string detailMessageFormat, params object?[] args) =>
Assert(condition, message, string.Format(detailMessageFormat, args));
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void WriteLine(string? message)
- {
+ public static void WriteLine(string? message) =>
s_provider.WriteLine(message);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void Write(string? message)
- {
+ public static void Write(string? message) =>
s_provider.Write(message);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void WriteLine(object? value)
- {
+ public static void WriteLine(object? value) =>
WriteLine(value?.ToString());
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void WriteLine(object? value, string? category)
- {
+ public static void WriteLine(object? value, string? category) =>
WriteLine(value?.ToString(), category);
- }
[System.Diagnostics.Conditional("DEBUG")]
- public static void WriteLine(string format, params object?[] args)
- {
+ public static void WriteLine(string format, params object?[] args) =>
WriteLine(string.Format(null, format, args));
- }
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(string? message, string? category)
}
[System.Diagnostics.Conditional("DEBUG")]
- public static void Write(object? value)
- {
+ public static void Write(object? value) =>
Write(value?.ToString());
- }
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(string? message, string? category)
}
[System.Diagnostics.Conditional("DEBUG")]
- public static void Write(object? value, string? category)
- {
+ public static void Write(object? value, string? category) =>
Write(value?.ToString(), category);
- }
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, string? message)
private string _displayName = "";
public string DisplayName
{
- get { return _displayName; }
+ get => _displayName;
set
{
if (value == null)
private string _displayUnits = "";
public string DisplayUnits
{
- get { return _displayUnits; }
+ get => _displayUnits;
set
{
if (value == null)
internal int TraceLoggingId => m_traceloggingId;
- public override bool Equals(object? obj)
- {
- if (!(obj is EventDescriptor))
- return false;
-
- return Equals((EventDescriptor)obj);
- }
-
- public override int GetHashCode()
- {
- return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords;
- }
-
- public bool Equals(EventDescriptor other)
- {
- if ((m_id != other.m_id) ||
- (m_version != other.m_version) ||
- (m_channel != other.m_channel) ||
- (m_level != other.m_level) ||
- (m_opcode != other.m_opcode) ||
- (m_task != other.m_task) ||
- (m_keywords != other.m_keywords))
- {
- return false;
- }
- return true;
- }
-
- public static bool operator ==(EventDescriptor event1, EventDescriptor event2)
- {
- return event1.Equals(event2);
- }
-
- public static bool operator !=(EventDescriptor event1, EventDescriptor event2)
- {
- return !event1.Equals(event2);
- }
+ public override bool Equals(object? obj) =>
+ obj is EventDescriptor ed && Equals(ed);
+
+ public override int GetHashCode() =>
+ m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords;
+
+ public bool Equals(EventDescriptor other) =>
+ m_id == other.m_id &&
+ m_version == other.m_version &&
+ m_channel == other.m_channel &&
+ m_level == other.m_level &&
+ m_opcode == other.m_opcode &&
+ m_task == other.m_task &&
+ m_keywords == other.m_keywords;
+
+ public static bool operator ==(EventDescriptor event1, EventDescriptor event2) =>
+ event1.Equals(event2);
+
+ public static bool operator !=(EventDescriptor event1, EventDescriptor event2) =>
+ !event1.Equals(event2);
}
}
EventPipe
}
- // New in CLR4.0
internal enum ControllerCommand
{
// Strictly Positive numbers are for provider-specific commands, negative number are for 'shared' commands. 256
}
}
- // New in CLR4.0
protected virtual void OnControllerCommand(ControllerCommand command, IDictionary<string, string?>? arguments, int sessionId, int etwSessionId) { }
- protected EventLevel Level { get { return (EventLevel)m_level; } set { m_level = (byte)value; } }
- protected EventKeywords MatchAnyKeyword { get { return (EventKeywords)m_anyKeywordMask; } set { m_anyKeywordMask = unchecked((long)value); } }
- protected EventKeywords MatchAllKeyword { get { return (EventKeywords)m_allKeywordMask; } set { m_allKeywordMask = unchecked((long)value); } }
+
+ protected EventLevel Level
+ {
+ get => (EventLevel)m_level;
+ set => m_level = (byte)value;
+ }
+
+ protected EventKeywords MatchAnyKeyword
+ {
+ get => (EventKeywords)m_anyKeywordMask;
+ set => m_anyKeywordMask = unchecked((long)value);
+ }
+
+ protected EventKeywords MatchAllKeyword
+ {
+ get => (EventKeywords)m_allKeywordMask;
+ set => m_allKeywordMask = unchecked((long)value);
+ }
private static int FindNull(byte[] buffer, int idx)
{
/// Address where the one argument lives (if this points to managed memory you must ensure the
/// managed object is pinned.
/// </summary>
- public unsafe IntPtr DataPointer { get { return (IntPtr)(void*)m_Ptr; } set { m_Ptr = unchecked((ulong)(void*)value); } }
+ public unsafe IntPtr DataPointer
+ {
+ get => (IntPtr)(void*)m_Ptr;
+ set => m_Ptr = unchecked((ulong)(void*)value);
+ }
/// <summary>
/// Size of the argument referenced by DataPointer
/// </summary>
- public int Size { get { return m_Size; } set { m_Size = value; } }
+ public int Size
+ {
+ get => m_Size;
+ set => m_Size = value;
+ }
/// <summary>
/// Reserved by ETW. This property is present to ensure that we can zero it
/// since System.Private.CoreLib uses are not zero'd.
/// </summary>
- internal int Reserved { get { return m_Reserved; } set { m_Reserved = value; } }
+ internal int Reserved
+ {
+ get => m_Reserved;
+ set => m_Reserved = value;
+ }
#region private
/// <summary>
return m_eventSource.m_eventData[EventId].Name;
}
}
- internal set
- {
- m_eventName = value;
- }
+ internal set => m_eventName = value;
}
/// <summary>
return activityId;
}
- internal set
- {
- m_activityId = value;
- }
+ internal set => m_activityId = value;
}
/// <summary>
return m_payloadNames;
}
- internal set
- {
- m_payloadNames = value;
- }
+ internal set => m_payloadNames = value;
}
/// <summary>
return m_eventSource.m_eventData[EventId].Message;
}
}
- internal set
- {
- m_message = value;
- }
+ internal set => m_message = value;
}
return m_osThreadId.Value;
}
- internal set
- {
- m_osThreadId = value;
- }
+ internal set => m_osThreadId = value;
}
/// <summary>
/// <summary>Event's operation code: allows defining operations, generally used with Tasks</summary>
public EventOpcode Opcode
{
- get
- {
- return m_opcode;
- }
+ get => m_opcode;
set
{
this.m_opcode = value;
}
}
- public static SessionMask operator |(SessionMask m1, SessionMask m2)
- {
- return new SessionMask(m1.m_mask | m2.m_mask);
- }
+ public static SessionMask operator |(SessionMask m1, SessionMask m2) =>
+ new SessionMask(m1.m_mask | m2.m_mask);
- public static SessionMask operator &(SessionMask m1, SessionMask m2)
- {
- return new SessionMask(m1.m_mask & m2.m_mask);
- }
+ public static SessionMask operator &(SessionMask m1, SessionMask m2) =>
+ new SessionMask(m1.m_mask & m2.m_mask);
- public static SessionMask operator ^(SessionMask m1, SessionMask m2)
- {
- return new SessionMask(m1.m_mask ^ m2.m_mask);
- }
+ public static SessionMask operator ^(SessionMask m1, SessionMask m2) =>
+ new SessionMask(m1.m_mask ^ m2.m_mask);
- public static SessionMask operator ~(SessionMask m)
- {
- return new SessionMask(MASK & ~(m.m_mask));
- }
+ public static SessionMask operator ~(SessionMask m) =>
+ new SessionMask(MASK & ~(m.m_mask));
- public static explicit operator ulong(SessionMask m)
- { return m.m_mask; }
+ public static explicit operator ulong(SessionMask m) => m.m_mask;
- public static explicit operator uint(SessionMask m)
- { return m.m_mask; }
+ public static explicit operator uint(SessionMask m) => m.m_mask;
private uint m_mask;
/// </summary>
internal EventLevel Level
{
- get { return this.level; }
- set { this.level = value; }
+ get => this.level;
+ set => this.level = value;
}
/// <summary>
/// </summary>
internal EventOpcode Opcode
{
- get { return this.opcode; }
- set { this.opcode = value; }
+ get => this.opcode;
+ set => this.opcode = value;
}
/// <summary>
throw new System.Collections.Generic.KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key));
}
- set
- {
- throw new System.NotSupportedException();
- }
+ set => throw new System.NotSupportedException();
}
public void Add(string key, object? value)
/// <summary>
/// You can make an activity out of just an EventSource.
/// </summary>
- public static implicit operator EventSourceActivity(EventSource eventSource) { return new EventSourceActivity(eventSource); }
+ public static implicit operator EventSourceActivity(EventSource eventSource) =>
+ new EventSourceActivity(eventSource);
/* Properties */
/// <summary>
/// </summary>
public EventLevel Level
{
- get
- {
- return (EventLevel)this.level;
- }
-
+ get => (EventLevel)this.level;
set
{
this.level = checked((byte)value);
/// </summary>
public EventOpcode Opcode
{
- get
- {
- return (EventOpcode)this.opcode;
- }
-
+ get => (EventOpcode)this.opcode;
set
{
this.opcode = checked((byte)value);
/// </summary>
public EventKeywords Keywords
{
- get
- {
- return this.keywords;
- }
-
+ get => this.keywords;
set
{
this.keywords = value;
/// </summary>
public EventTags Tags
{
- get
- {
- return this.tags;
- }
-
+ get => this.tags;
set
{
this.tags = value;
/// </summary>
public EventActivityOptions ActivityOptions
{
- get
- {
- return this.activityOptions;
- }
+ get => this.activityOptions;
set
{
this.activityOptions = value;
}
[NonVersionable]
- public static bool operator ==(double left, double right)
- {
- return left == right;
- }
+ public static bool operator ==(double left, double right) => left == right;
[NonVersionable]
- public static bool operator !=(double left, double right)
- {
- return left != right;
- }
+ public static bool operator !=(double left, double right) => left != right;
[NonVersionable]
- public static bool operator <(double left, double right)
- {
- return left < right;
- }
+ public static bool operator <(double left, double right) => left < right;
[NonVersionable]
- public static bool operator >(double left, double right)
- {
- return left > right;
- }
+ public static bool operator >(double left, double right) => left > right;
[NonVersionable]
- public static bool operator <=(double left, double right)
- {
- return left <= right;
- }
+ public static bool operator <=(double left, double right) => left <= right;
[NonVersionable]
- public static bool operator >=(double left, double right)
- {
- return left >= right;
- }
+ public static bool operator >=(double left, double right) => left >= right;
public bool Equals(double obj)
{
// "file:///C:/Applications/Bazzal/help.html#ErrorNum42"
public virtual string? HelpLink
{
- get
- {
- return _helpURL;
- }
- set
- {
- _helpURL = value;
- }
+ get => _helpURL;
+ set => _helpURL = value;
}
public virtual string? Source
{
- get
- {
- return _source ?? (_source = CreateSourceName());
- }
- set
- {
- _source = value;
- }
+ get => _source ?? (_source = CreateSourceName());
+ set => _source = value;
}
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
public int HResult
{
- get
- {
- return _HResult;
- }
- set
- {
- _HResult = value;
- }
+ get => _HResult;
+ set => _HResult = value;
}
// this method is required so Object.GetType is not made virtual by the compiler
public static CultureInfo? DefaultThreadCurrentCulture
{
get => s_DefaultThreadCurrentCulture;
- set
- {
+ set =>
// If you add pre-conditions to this method, check to see if you also need to
// add them to Thread.CurrentCulture.set.
s_DefaultThreadCurrentCulture = value;
- }
}
public static CultureInfo? DefaultThreadCurrentUICulture
public bool AllowUnassigned
{
- get { return _allowUnassigned; }
- set { _allowUnassigned = value; }
+ get => _allowUnassigned;
+ set => _allowUnassigned = value;
}
public bool UseStd3AsciiRules
{
- get { return _useStd3AsciiRules; }
- set { _useStd3AsciiRules = value; }
+ get => _useStd3AsciiRules;
+ set => _useStd3AsciiRules = value;
}
// Gets ASCII (Punycode) version of the string
- public string GetAscii(string unicode)
- {
- return GetAscii(unicode, 0);
- }
+ public string GetAscii(string unicode) =>
+ GetAscii(unicode, 0);
public string GetAscii(string unicode, int index)
{
}
// Gets Unicode version of the string. Normalized and limited to IDNA characters.
- public string GetUnicode(string ascii)
- {
- return GetUnicode(ascii, 0);
- }
+ public string GetUnicode(string ascii) =>
+ GetUnicode(ascii, 0);
public string GetUnicode(string ascii, int index)
{
}
}
- public override bool Equals(object? obj)
- {
- return
- obj is IdnMapping that &&
- _allowUnassigned == that._allowUnassigned &&
- _useStd3AsciiRules == that._useStd3AsciiRules;
- }
+ public override bool Equals(object? obj) =>
+ obj is IdnMapping that &&
+ _allowUnassigned == that._allowUnassigned &&
+ _useStd3AsciiRules == that._useStd3AsciiRules;
- public override int GetHashCode()
- {
- return (_allowUnassigned ? 100 : 200) + (_useStd3AsciiRules ? 1000 : 2000);
- }
+ public override int GetHashCode() =>
+ (_allowUnassigned ? 100 : 200) + (_useStd3AsciiRules ? 1000 : 2000);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static unsafe string GetStringForOutput(string originalString, char* input, int inputLength, char* output, int outputLength)
- {
- return originalString.Length == inputLength && new ReadOnlySpan<char>(input, inputLength).SequenceEqual(new ReadOnlySpan<char>(output, outputLength)) ?
+ private static unsafe string GetStringForOutput(string originalString, char* input, int inputLength, char* output, int outputLength) =>
+ originalString.Length == inputLength && new ReadOnlySpan<char>(input, inputLength).SequenceEqual(new ReadOnlySpan<char>(output, outputLength)) ?
originalString :
new string(output, 0, outputLength);
- }
//
// Invariant implementation
// Legal "dot" separators (i.e: . in www.microsoft.com)
- private static readonly char[] c_Dots = { '.', '\u3002', '\uFF0E', '\uFF61' };
+ private static readonly char[] s_dotSeparators = { '.', '\u3002', '\uFF0E', '\uFF61' };
private string GetAsciiInvariant(string unicode, int index, int count)
{
while (iNextDot < unicode.Length)
{
// Find end of this segment
- iNextDot = unicode.IndexOfAny(c_Dots, iAfterLastDot);
+ iNextDot = unicode.IndexOfAny(s_dotSeparators, iAfterLastDot);
Debug.Assert(iNextDot <= unicode.Length, "[IdnMapping.punycode_encode]IndexOfAny is broken");
if (iNextDot < 0)
iNextDot = unicode.Length;
// are we U+002E (., full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), or
// U+FF61 (halfwidth ideographic full stop).
// Note: IDNA Normalization gets rid of dots now, but testing for last dot is before normalization
- private static bool IsDot(char c)
- {
- return c == '.' || c == '\u3002' || c == '\uFF0E' || c == '\uFF61';
- }
+ private static bool IsDot(char c) =>
+ c == '.' || c == '\u3002' || c == '\uFF0E' || c == '\uFF61';
- private static bool IsSupplementary(int cTest)
- {
- return cTest >= 0x10000;
- }
+ private static bool IsSupplementary(int cTest) =>
+ cTest >= 0x10000;
- private static bool Basic(uint cp)
- {
+ private static bool Basic(uint cp) =>
// Is it in ASCII range?
- return cp < 0x80;
- }
+ cp < 0x80;
// Validate Std3 rules for a character
private static void ValidateStd3(char c, bool bNextToDot)
}
// Return whether a punycode code point is flagged as being upper case.
- private static bool HasUpperCaseFlag(char punychar)
- {
- return (punychar >= 'A' && punychar <= 'Z');
- }
+ private static bool HasUpperCaseFlag(char punychar) =>
+ punychar >= 'A' && punychar <= 'Z';
/* EncodeDigit(d,flag) returns the basic code point whose value */
/* (when used for representing integers) is d, which needs to be in */
return right.Equals(left);
}
- public static bool operator !=(SortVersion? left, SortVersion? right)
- {
- return !(left == right);
- }
+ public static bool operator !=(SortVersion? left, SortVersion? right) =>
+ !(left == right);
}
}
return 0;
}
- public static bool operator ==(Guid a, Guid b)
- {
- // Now compare each of the elements
- return a._a == b._a &&
+ public static bool operator ==(Guid a, Guid b) =>
+ a._a == b._a &&
Unsafe.Add(ref a._a, 1) == Unsafe.Add(ref b._a, 1) &&
Unsafe.Add(ref a._a, 2) == Unsafe.Add(ref b._a, 2) &&
Unsafe.Add(ref a._a, 3) == Unsafe.Add(ref b._a, 3);
- }
- public static bool operator !=(Guid a, Guid b)
- {
+ public static bool operator !=(Guid a, Guid b) =>
// Now compare each of the elements
- return a._a != b._a ||
+ a._a != b._a ||
Unsafe.Add(ref a._a, 1) != Unsafe.Add(ref b._a, 1) ||
Unsafe.Add(ref a._a, 2) != Unsafe.Add(ref b._a, 2) ||
Unsafe.Add(ref a._a, 3) != Unsafe.Add(ref b._a, 3);
- }
public string ToString(string? format)
{
public virtual int ReadTimeout
{
- get
- {
- throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
- }
- set
- {
- throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
- }
+ get => throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
+ set => throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
public virtual int WriteTimeout
{
- get
- {
- throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
- }
- set
- {
- throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
- }
+ get => throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
+ set => throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
public Task CopyToAsync(Stream destination)
public override long Position
{
- get { return 0; }
+ get => 0;
set { }
}
public override int ReadTimeout
{
- get
- {
- return _stream.ReadTimeout;
- }
- set
- {
- _stream.ReadTimeout = value;
- }
+ get => _stream.ReadTimeout;
+ set => _stream.ReadTimeout = value;
}
public override int WriteTimeout
{
- get
- {
- return _stream.WriteTimeout;
- }
- set
- {
- _stream.WriteTimeout = value;
- }
+ get => _stream.WriteTimeout;
+ set => _stream.WriteTimeout = value;
}
// In the off chance that some wrapped stream has different
public virtual bool AutoFlush
{
- get { return _autoFlush; }
+ get => _autoFlush;
set
{
[AllowNull]
public virtual string NewLine
{
- get { return CoreNewLineStr; }
+ get => CoreNewLineStr;
set
{
if (value == null)
public override string NewLine
{
[MethodImpl(MethodImplOptions.Synchronized)]
- get { return _out.NewLine; }
+ get => _out.NewLine;
[MethodImpl(MethodImplOptions.Synchronized)]
- set { _out.NewLine = value; }
+ set => _out.NewLine = value;
}
[MethodImpl(MethodImplOptions.Synchronized)]
public override int Capacity
{
- get
- {
- return (int)_unmanagedStream.Capacity;
- }
- set
- {
- throw new IOException(SR.IO_FixedCapacity);
- }
+ get => (int)_unmanagedStream.Capacity;
+ set => throw new IOException(SR.IO_FixedCapacity);
}
public override long Length => _unmanagedStream.Length;
public override long Position
{
- get
- {
- return _unmanagedStream.Position;
- }
- set
- {
- _unmanagedStream.Position = value;
- }
+ get => _unmanagedStream.Position;
+ set => _unmanagedStream.Position = value;
}
public override int Read(byte[] buffer, int offset, int count)
info.AddValue("value", ToInt64());
}
- public override unsafe bool Equals(object? obj)
- {
- if (obj is IntPtr)
- {
- return (_value == ((IntPtr)obj)._value);
- }
- return false;
- }
+ public override unsafe bool Equals(object? obj) =>
+ obj is IntPtr other &&
+ _value == other._value;
- unsafe bool IEquatable<IntPtr>.Equals(IntPtr other)
- {
- return _value == other._value;
- }
+ unsafe bool IEquatable<IntPtr>.Equals(IntPtr other) =>
+ _value == other._value;
public override unsafe int GetHashCode()
{
[Intrinsic]
[NonVersionable]
- public unsafe long ToInt64()
- {
- return (nint)_value;
- }
+ public unsafe long ToInt64() =>
+ (nint)_value;
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator IntPtr(int value)
- {
- return new IntPtr(value);
- }
+ public static unsafe explicit operator IntPtr(int value) =>
+ new IntPtr(value);
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator IntPtr(long value)
- {
- return new IntPtr(value);
- }
+ public static unsafe explicit operator IntPtr(long value) =>
+ new IntPtr(value);
[CLSCompliant(false)]
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator IntPtr(void* value)
- {
- return new IntPtr(value);
- }
+ public static unsafe explicit operator IntPtr(void* value) =>
+ new IntPtr(value);
[CLSCompliant(false)]
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator void*(IntPtr value)
- {
- return value._value;
- }
+ public static unsafe explicit operator void*(IntPtr value) =>
+ value._value;
[Intrinsic]
[NonVersionable]
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator long(IntPtr value)
- {
- return (nint)value._value;
- }
+ public static unsafe explicit operator long(IntPtr value) =>
+ (nint)value._value;
[Intrinsic]
[NonVersionable]
- public static unsafe bool operator ==(IntPtr value1, IntPtr value2)
- {
- return value1._value == value2._value;
- }
+ public static unsafe bool operator ==(IntPtr value1, IntPtr value2) =>
+ value1._value == value2._value;
[Intrinsic]
[NonVersionable]
- public static unsafe bool operator !=(IntPtr value1, IntPtr value2)
- {
- return value1._value != value2._value;
- }
+ public static unsafe bool operator !=(IntPtr value1, IntPtr value2) =>
+ value1._value != value2._value;
[NonVersionable]
- public static IntPtr Add(IntPtr pointer, int offset)
- {
- return pointer + offset;
- }
+ public static IntPtr Add(IntPtr pointer, int offset) =>
+ pointer + offset;
[Intrinsic]
[NonVersionable]
- public static unsafe IntPtr operator +(IntPtr pointer, int offset)
- {
- return new IntPtr((nint)pointer._value + offset);
- }
+ public static unsafe IntPtr operator +(IntPtr pointer, int offset) =>
+ new IntPtr((nint)pointer._value + offset);
[NonVersionable]
- public static IntPtr Subtract(IntPtr pointer, int offset)
- {
- return pointer - offset;
- }
+ public static IntPtr Subtract(IntPtr pointer, int offset) =>
+ pointer - offset;
[Intrinsic]
[NonVersionable]
- public static unsafe IntPtr operator -(IntPtr pointer, int offset)
- {
- return new IntPtr((nint)pointer._value - offset);
- }
+ public static unsafe IntPtr operator -(IntPtr pointer, int offset) =>
+ new IntPtr((nint)pointer._value - offset);
public static int Size
{
[Intrinsic]
[NonVersionable]
- get
- {
- return sizeof(nint);
- }
+ get => sizeof(nint);
}
[CLSCompliant(false)]
[Intrinsic]
[NonVersionable]
- public unsafe void* ToPointer()
- {
- return _value;
- }
+ public unsafe void* ToPointer() => _value;
- public override unsafe string ToString()
- {
- return ((nint)_value).ToString(CultureInfo.InvariantCulture);
- }
+ public override unsafe string ToString() =>
+ ((nint)_value).ToString(CultureInfo.InvariantCulture);
- public unsafe string ToString(string format)
- {
- return ((nint)_value).ToString(format, CultureInfo.InvariantCulture);
- }
+ public unsafe string ToString(string format) =>
+ ((nint)_value).ToString(format, CultureInfo.InvariantCulture);
}
}
public static bool EnforceJapaneseEraYearRanges
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue("Switch.System.Globalization.EnforceJapaneseEraYearRanges", ref s_enforceJapaneseEraYearRanges);
- }
+ get => GetCachedSwitchValue("Switch.System.Globalization.EnforceJapaneseEraYearRanges", ref s_enforceJapaneseEraYearRanges);
}
private static int s_formatJapaneseFirstYearAsANumber;
public static bool FormatJapaneseFirstYearAsANumber
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue("Switch.System.Globalization.FormatJapaneseFirstYearAsANumber", ref s_formatJapaneseFirstYearAsANumber);
- }
+ get => GetCachedSwitchValue("Switch.System.Globalization.FormatJapaneseFirstYearAsANumber", ref s_formatJapaneseFirstYearAsANumber);
}
private static int s_enforceLegacyJapaneseDateParsing;
public static bool EnforceLegacyJapaneseDateParsing
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue("Switch.System.Globalization.EnforceLegacyJapaneseDateParsing", ref s_enforceLegacyJapaneseDateParsing);
- }
+ get => GetCachedSwitchValue("Switch.System.Globalization.EnforceLegacyJapaneseDateParsing", ref s_enforceLegacyJapaneseDateParsing);
}
private static int s_preserveEventListnerObjectIdentity;
public static bool PreserveEventListnerObjectIdentity
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue("Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity", ref s_preserveEventListnerObjectIdentity);
- }
+ get => GetCachedSwitchValue("Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity", ref s_preserveEventListnerObjectIdentity);
}
private static int s_serializationGuard;
public static bool SerializationGuard
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue("Switch.System.Runtime.Serialization.SerializationGuard", ref s_serializationGuard);
- }
+ get => GetCachedSwitchValue("Switch.System.Runtime.Serialization.SerializationGuard", ref s_serializationGuard);
}
}
}
public bool HasValue
{
[NonVersionable]
- get
- {
- return hasValue;
- }
+ get => hasValue;
}
public T Value
}
[NonVersionable]
- public T GetValueOrDefault()
- {
- return value;
- }
+ public T GetValueOrDefault() => value;
[NonVersionable]
- public T GetValueOrDefault(T defaultValue)
- {
- return hasValue ? value : defaultValue;
- }
+ public T GetValueOrDefault(T defaultValue) =>
+ hasValue ? value : defaultValue;
public override bool Equals(object? other)
{
return value.Equals(other);
}
- public override int GetHashCode()
- {
- return hasValue ? value.GetHashCode() : 0;
- }
+ public override int GetHashCode() => hasValue ? value.GetHashCode() : 0;
- public override string? ToString()
- {
- return hasValue ? value.ToString() : "";
- }
+ public override string? ToString() => hasValue ? value.ToString() : "";
[NonVersionable]
- public static implicit operator Nullable<T>(T value)
- {
- return new Nullable<T>(value);
- }
+ public static implicit operator Nullable<T>(T value) =>
+ new Nullable<T>(value);
[NonVersionable]
- public static explicit operator T(Nullable<T> value)
- {
- return value!.Value;
- }
+ public static explicit operator T(Nullable<T> value) => value!.Value;
}
public static class Nullable
public static Vector<T> Zero
{
[Intrinsic]
- get
- {
- return s_zero;
- }
+ get => s_zero;
}
private static readonly Vector<T> s_zero = new Vector<T>();
public static Vector<T> One
{
[Intrinsic]
- get
- {
- return s_one;
- }
+ get => s_one;
}
private static readonly Vector<T> s_one = new Vector<T>(GetOneValue());
internal static Vector<T> AllOnes
{
[Intrinsic]
- get
- {
- return s_allOnes;
- }
+ get => s_allOnes;
}
private static readonly Vector<T> s_allOnes = new Vector<T>(GetAllBitsSetValue());
#endregion Static Members
/// <param name="factor">The scalar value.</param>
/// <returns>The scaled vector.</returns>
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
- public static Vector<T> operator *(Vector<T> value, T factor)
- {
- return new Vector<T>(factor) * value;
- }
+ public static Vector<T> operator *(Vector<T> value, T factor) =>
+ new Vector<T>(factor) * value;
/// <summary>
/// Multiplies a vector by the given scalar.
/// <param name="value">The source vector.</param>
/// <returns>The scaled vector.</returns>
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
- public static Vector<T> operator *(T factor, Vector<T> value)
- {
- return new Vector<T>(factor) * value;
- }
+ public static Vector<T> operator *(T factor, Vector<T> value) =>
+ new Vector<T>(factor) * value;
// This method is intrinsic only for certain types. It cannot access fields directly unless we are sure the context is unaccelerated.
/// <summary>
/// </summary>
/// <param name="value">The source vector.</param>
/// <returns>The negated vector.</returns>
- public static Vector<T> operator -(Vector<T> value)
- {
- return Zero - value;
- }
+ public static Vector<T> operator -(Vector<T> value) => Zero - value;
#endregion Arithmetic Operators
#region Bitwise Operators
/// <param name="value">The source vector.</param>
/// <returns>The one's complement vector.</returns>
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
- public static Vector<T> operator ~(Vector<T> value)
- {
- return s_allOnes ^ value;
- }
+ public static Vector<T> operator ~(Vector<T> value) =>
+ s_allOnes ^ value;
#endregion Bitwise Operators
#region Logical Operators
/// <returns>True if all elements are equal; False otherwise.</returns>
[Intrinsic]
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
- public static bool operator ==(Vector<T> left, Vector<T> right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(Vector<T> left, Vector<T> right) =>
+ left.Equals(right);
/// <summary>
/// Returns a boolean indicating whether any single pair of elements in the given vectors are not equal.
/// <returns>True if left and right are not equal; False otherwise.</returns>
[Intrinsic]
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
- public static bool operator !=(Vector<T> left, Vector<T> right)
- {
- return !(left == right);
- }
+ public static bool operator !=(Vector<T> left, Vector<T> right) => !(left == right);
#endregion Logical Operators
#region Conversions
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<byte>(Vector<T> value)
- {
- return new Vector<byte>(ref value.register);
- }
+ public static explicit operator Vector<byte>(Vector<T> value) =>
+ new Vector<byte>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[Intrinsic]
- public static explicit operator Vector<sbyte>(Vector<T> value)
- {
- return new Vector<sbyte>(ref value.register);
- }
+ public static explicit operator Vector<sbyte>(Vector<T> value) =>
+ new Vector<sbyte>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[Intrinsic]
- public static explicit operator Vector<ushort>(Vector<T> value)
- {
- return new Vector<ushort>(ref value.register);
- }
+ public static explicit operator Vector<ushort>(Vector<T> value) =>
+ new Vector<ushort>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<short>(Vector<T> value)
- {
- return new Vector<short>(ref value.register);
- }
+ public static explicit operator Vector<short>(Vector<T> value) =>
+ new Vector<short>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[Intrinsic]
- public static explicit operator Vector<uint>(Vector<T> value)
- {
- return new Vector<uint>(ref value.register);
- }
+ public static explicit operator Vector<uint>(Vector<T> value) =>
+ new Vector<uint>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<int>(Vector<T> value)
- {
- return new Vector<int>(ref value.register);
- }
+ public static explicit operator Vector<int>(Vector<T> value) =>
+ new Vector<int>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[Intrinsic]
- public static explicit operator Vector<ulong>(Vector<T> value)
- {
- return new Vector<ulong>(ref value.register);
- }
+ public static explicit operator Vector<ulong>(Vector<T> value) =>
+ new Vector<ulong>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<long>(Vector<T> value)
- {
- return new Vector<long>(ref value.register);
- }
+ public static explicit operator Vector<long>(Vector<T> value) =>
+ new Vector<long>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<float>(Vector<T> value)
- {
- return new Vector<float>(ref value.register);
- }
+ public static explicit operator Vector<float>(Vector<T> value) =>
+ new Vector<float>(ref value.register);
/// <summary>
/// Reinterprets the bits of the given vector into those of another type.
/// <param name="value">The source vector</param>
/// <returns>The reinterpreted vector.</returns>
[Intrinsic]
- public static explicit operator Vector<double>(Vector<T> value)
- {
- return new Vector<double>(ref value.register);
- }
+ public static explicit operator Vector<double>(Vector<T> value) =>
+ new Vector<double>(ref value.register);
#endregion Conversions
public static bool IsHardwareAccelerated
{
[Intrinsic]
- get
- {
- return false;
- }
+ get => false;
}
// Vector<T>
public CancellationToken CancellationToken
{
- get { return _cancellationToken; }
- private set { _cancellationToken = value; }
+ get => _cancellationToken;
+ private set => _cancellationToken = value;
}
public OperationCanceledException()
/// Returns true if left and right point at the same memory and have the same length. Note that
/// this does *not* check to see if the *contents* are equal.
/// </summary>
- public static bool operator ==(ReadOnlySpan<T> left, ReadOnlySpan<T> right)
- {
- return left._length == right._length && Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
- }
+ public static bool operator ==(ReadOnlySpan<T> left, ReadOnlySpan<T> right) =>
+ left._length == right._length &&
+ Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
/// <summary>
/// For <see cref="ReadOnlySpan{Char}"/>, returns a new instance of string that represents the characters pointed to by the span.
public int Length
{
[NonVersionable]
- get
- {
- return _length;
- }
+ get => _length;
}
/// <summary>
public bool IsEmpty
{
[NonVersionable]
- get
- {
- // Workaround for https://github.com/dotnet/coreclr/issues/19620
- return 0 >= (uint)_length;
- }
+ get => 0 >= (uint)_length; // Workaround for https://github.com/dotnet/coreclr/issues/19620
}
+
/// <summary>
/// Returns false if left and right point at the same memory and have the same length. Note that
/// this does *not* check to see if the *contents* are equal.
/// </summary>
[Obsolete("Equals() on ReadOnlySpan will always throw an exception. Use == instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object? obj)
- {
+ public override bool Equals(object? obj) =>
throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
- }
/// <summary>
/// This method is not supported as spans cannot be boxed.
/// </summary>
[Obsolete("GetHashCode() on ReadOnlySpan will always throw an exception.")]
[EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode()
- {
+ public override int GetHashCode() =>
throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
- }
/// <summary>
/// Defines an implicit conversion of an array to a <see cref="ReadOnlySpan{T}"/>
return (left is null) ? false : left.Equals(right);
}
- public static bool operator !=(Assembly? left, Assembly? right)
- {
- return !(left == right);
- }
+ public static bool operator !=(Assembly? left, Assembly? right) => !(left == right);
public static string CreateQualifiedName(string? assemblyName, string? typeName) => typeName + ", " + assemblyName;
// the name partitions up the strong name's namespace
public string? Name
{
- get { return _name; }
- set { _name = value; }
+ get => _name;
+ set => _name = value;
}
public Version? Version
{
- get { return _version; }
- set { _version = value; }
+ get => _version;
+ set => _version = value;
}
// Locales, internally the LCID is used for the match.
public CultureInfo? CultureInfo
{
- get { return _cultureInfo; }
- set { _cultureInfo = value; }
+ get => _cultureInfo;
+ set => _cultureInfo = value;
}
public string? CultureName
{
- get
- {
- return _cultureInfo?.Name;
- }
- set
- {
- _cultureInfo = (value == null) ? null : new CultureInfo(value);
- }
+ get => _cultureInfo?.Name;
+ set => _cultureInfo = (value == null) ? null : new CultureInfo(value);
}
public string? CodeBase
{
- get { return _codeBase; }
- set { _codeBase = value; }
+ get => _codeBase;
+ set => _codeBase = value;
}
public string? EscapedCodeBase
// set or retrieved directly
public AssemblyNameFlags Flags
{
- get { return (AssemblyNameFlags)((uint)_flags & 0xFFFFF10F); }
+ get => (AssemblyNameFlags)((uint)_flags & 0xFFFFF10F);
set
{
_flags &= unchecked((AssemblyNameFlags)0x00000EF0);
public AssemblyHashAlgorithm HashAlgorithm
{
- get { return _hashAlgorithm; }
- set { _hashAlgorithm = value; }
+ get => _hashAlgorithm;
+ set => _hashAlgorithm = value;
}
public AssemblyVersionCompatibility VersionCompatibility
{
- get { return _versionCompatibility; }
- set { _versionCompatibility = value; }
+ get => _versionCompatibility;
+ set => _versionCompatibility = value;
}
public StrongNameKeyPair? KeyPair
{
- get { return _strongNameKeyPair; }
- set { _strongNameKeyPair = value; }
+ get => _strongNameKeyPair;
+ set => _strongNameKeyPair = value;
}
public string FullName
{
internal readonly int m_label;
- internal Label(int label)
- {
- m_label = label;
- }
+ internal Label(int label) => m_label = label;
- internal int GetLabelValue()
- {
- return m_label;
- }
+ internal int GetLabelValue() => m_label;
- public override int GetHashCode()
- {
- return m_label;
- }
+ public override int GetHashCode() => m_label;
- public override bool Equals(object? obj)
- {
- if (obj is Label)
- return Equals((Label)obj);
- else
- return false;
- }
+ public override bool Equals(object? obj) =>
+ obj is Label other && Equals(other);
- public bool Equals(Label obj)
- {
- return obj.m_label == m_label;
- }
+ public bool Equals(Label obj) =>
+ obj.m_label == m_label;
- public static bool operator ==(Label a, Label b)
- {
- return a.Equals(b);
- }
+ public static bool operator ==(Label a, Label b) => a.Equals(b);
- public static bool operator !=(Label a, Label b)
- {
- return !(a == b);
- }
+ public static bool operator !=(Label a, Label b) => !(a == b);
}
}
m_flags = flags;
}
- internal bool EndsUncondJmpBlk()
- {
- return (m_flags & EndsUncondJmpBlkFlag) != 0;
- }
+ internal bool EndsUncondJmpBlk() =>
+ (m_flags & EndsUncondJmpBlkFlag) != 0;
- internal int StackChange()
- {
- return (m_flags >> StackChangeShift);
- }
+ internal int StackChange() =>
+ m_flags >> StackChangeShift;
public OperandType OperandType => (OperandType)(m_flags & OperandTypeMask);
}
}
- public override bool Equals(object? obj)
- {
- if (obj is OpCode)
- return Equals((OpCode)obj);
- else
- return false;
- }
+ public override bool Equals(object? obj) =>
+ obj is OpCode other && Equals(other);
- public bool Equals(OpCode obj)
- {
- return obj.Value == Value;
- }
+ public bool Equals(OpCode obj) => obj.Value == Value;
- public static bool operator ==(OpCode a, OpCode b)
- {
- return a.Equals(b);
- }
+ public static bool operator ==(OpCode a, OpCode b) => a.Equals(b);
- public static bool operator !=(OpCode a, OpCode b)
- {
- return !(a == b);
- }
+ public static bool operator !=(OpCode a, OpCode b) => !(a == b);
- public override int GetHashCode()
- {
- return Value;
- }
+ public override int GetHashCode() => Value;
- public override string? ToString()
- {
- return Name;
- }
+ public override string? ToString() => Name;
}
}
public bool this[int index]
{
- get
- {
- return _byRef[index];
- }
- set
- {
- _byRef[index] = value;
- }
+ get => _byRef[index];
+ set => _byRef[index] = value;
}
#if CORECLR
// GetString or GetObject.
public virtual bool IgnoreCase
{
- get { return _ignoreCase; }
- set { _ignoreCase = value; }
+ get => _ignoreCase;
+ set => _ignoreCase = value;
}
// Returns the Type of the ResourceSet the ResourceManager uses
protected UltimateResourceFallbackLocation FallbackLocation
{
- get { return _fallbackLoc; }
- set { _fallbackLoc = value; }
+ get => _fallbackLoc;
+ set => _fallbackLoc = value;
}
// Tells the ResourceManager to call Close on all ResourceSets and
internal CultureInfo? NeutralResourcesCulture
{
- get { return _rm._neutralResourcesCulture; }
- set { _rm._neutralResourcesCulture = value; }
+ get => _rm._neutralResourcesCulture;
+ set => _rm._neutralResourcesCulture = value;
}
- internal string GetResourceFileName(CultureInfo culture)
- {
- return _rm.GetResourceFileName(culture);
- }
+ internal string GetResourceFileName(CultureInfo culture) =>
+ _rm.GetResourceFileName(culture);
// NEEDED ONLY BY ASSEMBLY-BASED
internal bool LookedForSatelliteContractVersion
{
- get { return _rm._lookedForSatelliteContractVersion; }
- set { _rm._lookedForSatelliteContractVersion = value; }
+ get => _rm._lookedForSatelliteContractVersion;
+ set => _rm._lookedForSatelliteContractVersion = value;
}
internal Version? SatelliteContractVersion
{
- get { return _rm._satelliteContractVersion; }
- set { _rm._satelliteContractVersion = value; }
+ get => _rm._satelliteContractVersion;
+ set => _rm._satelliteContractVersion = value;
}
- internal Version? ObtainSatelliteContractVersion(Assembly a)
- {
- return ResourceManager.GetSatelliteContractVersion(a);
- }
+ internal Version? ObtainSatelliteContractVersion(Assembly a) =>
+ ResourceManager.GetSatelliteContractVersion(a);
internal UltimateResourceFallbackLocation FallbackLoc
{
- get { return _rm.FallbackLocation; }
- set { _rm._fallbackLoc = value; }
+ get => _rm.FallbackLocation;
+ set => _rm._fallbackLoc = value;
}
internal Assembly? MainAssembly => _rm.MainAssembly;
// resource profiling build. We could also use WeakReference.
internal object? Value
{
- get { return _value; }
- set { _value = value; }
+ get => _value;
+ set => _value = value;
}
internal static bool CanCache(ResourceTypeCode value)
object? IStrongBox.Value
{
- get
- {
- return Value;
- }
- set
- {
- Value = (T)value!;
- }
+ get => Value;
+ set => Value = (T)value!;
}
}
return obj.m_array == m_array && obj.m_offset == m_offset && obj.m_count == m_count;
}
- public static bool operator ==(ArrayWithOffset a, ArrayWithOffset b)
- {
- return a.Equals(b);
- }
+ public static bool operator ==(ArrayWithOffset a, ArrayWithOffset b) => a.Equals(b);
- public static bool operator !=(ArrayWithOffset a, ArrayWithOffset b)
- {
- return !(a == b);
- }
+ public static bool operator !=(ArrayWithOffset a, ArrayWithOffset b) => !(a == b);
}
}
public IntPtr Handle => _handle;
- public static explicit operator IntPtr(HandleRef value)
- {
- return value._handle;
- }
+ public static explicit operator IntPtr(HandleRef value) => value._handle;
- public static IntPtr ToIntPtr(HandleRef value)
- {
- return value._handle;
- }
+ public static IntPtr ToIntPtr(HandleRef value) => value._handle;
}
}
[CLSCompliant(false)]
public static class Aes
{
- public static bool IsSupported { [Intrinsic] get { return false; } }
+ public static bool IsSupported { [Intrinsic] get => false; }
/// <summary>
/// Performs AES single round decryption
[CLSCompliant(false)]
public static class Base
{
- public static bool IsSupported { [Intrinsic] get { return false; } }
+ public static bool IsSupported { [Intrinsic] get => false; }
/// <summary>
/// Vector LeadingSignCount
[CLSCompliant(false)]
public static class Sha1
{
- public static bool IsSupported { [Intrinsic] get { return false; } }
+ public static bool IsSupported { [Intrinsic] get => false; }
/// <summary>
/// Performs SHA1 hash update choose form.
[CLSCompliant(false)]
public static class Sha256
{
- public static bool IsSupported { [Intrinsic] get { return false; } }
+ public static bool IsSupported { [Intrinsic] get => false; }
/// <summary>
/// Performs SHA256 hash update (part 1).
/// IsSupported property indicates whether any method provided
/// by this class is supported by the current runtime.
/// </summary>
- public static bool IsSupported { [Intrinsic] get { return false; } }
+ public static bool IsSupported { [Intrinsic] get => false; }
/// <summary>
/// Vector abs
internal static bool IsSupported
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return (typeof(T) == typeof(byte)) ||
- (typeof(T) == typeof(sbyte)) ||
- (typeof(T) == typeof(short)) ||
- (typeof(T) == typeof(ushort)) ||
- (typeof(T) == typeof(int)) ||
- (typeof(T) == typeof(uint)) ||
- (typeof(T) == typeof(long)) ||
- (typeof(T) == typeof(ulong)) ||
- (typeof(T) == typeof(float)) ||
- (typeof(T) == typeof(double));
- }
+ get => (typeof(T) == typeof(byte)) ||
+ (typeof(T) == typeof(sbyte)) ||
+ (typeof(T) == typeof(short)) ||
+ (typeof(T) == typeof(ushort)) ||
+ (typeof(T) == typeof(int)) ||
+ (typeof(T) == typeof(uint)) ||
+ (typeof(T) == typeof(long)) ||
+ (typeof(T) == typeof(ulong)) ||
+ (typeof(T) == typeof(float)) ||
+ (typeof(T) == typeof(double));
}
/// <summary>Determines whether the specified <see cref="Vector128{T}" /> is equal to the current instance.</summary>
internal static bool IsSupported
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return (typeof(T) == typeof(byte)) ||
- (typeof(T) == typeof(sbyte)) ||
- (typeof(T) == typeof(short)) ||
- (typeof(T) == typeof(ushort)) ||
- (typeof(T) == typeof(int)) ||
- (typeof(T) == typeof(uint)) ||
- (typeof(T) == typeof(long)) ||
- (typeof(T) == typeof(ulong)) ||
- (typeof(T) == typeof(float)) ||
- (typeof(T) == typeof(double));
- }
+ get => (typeof(T) == typeof(byte)) ||
+ (typeof(T) == typeof(sbyte)) ||
+ (typeof(T) == typeof(short)) ||
+ (typeof(T) == typeof(ushort)) ||
+ (typeof(T) == typeof(int)) ||
+ (typeof(T) == typeof(uint)) ||
+ (typeof(T) == typeof(long)) ||
+ (typeof(T) == typeof(ulong)) ||
+ (typeof(T) == typeof(float)) ||
+ (typeof(T) == typeof(double));
}
/// <summary>Determines whether the specified <see cref="Vector256{T}" /> is equal to the current instance.</summary>
internal static bool IsSupported
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return (typeof(T) == typeof(byte)) ||
- (typeof(T) == typeof(sbyte)) ||
- (typeof(T) == typeof(short)) ||
- (typeof(T) == typeof(ushort)) ||
- (typeof(T) == typeof(int)) ||
- (typeof(T) == typeof(uint)) ||
- (typeof(T) == typeof(long)) ||
- (typeof(T) == typeof(ulong)) ||
- (typeof(T) == typeof(float)) ||
- (typeof(T) == typeof(double));
- }
+ get => (typeof(T) == typeof(byte)) ||
+ (typeof(T) == typeof(sbyte)) ||
+ (typeof(T) == typeof(short)) ||
+ (typeof(T) == typeof(ushort)) ||
+ (typeof(T) == typeof(int)) ||
+ (typeof(T) == typeof(uint)) ||
+ (typeof(T) == typeof(long)) ||
+ (typeof(T) == typeof(ulong)) ||
+ (typeof(T) == typeof(float)) ||
+ (typeof(T) == typeof(double));
}
/// <summary>Determines whether the specified <see cref="Vector64{T}" /> is equal to the current instance.</summary>
private static long LastKnownFreeAddressSpace
{
- get { return Volatile.Read(ref s_hiddenLastKnownFreeAddressSpace); }
- set { Volatile.Write(ref s_hiddenLastKnownFreeAddressSpace, value); }
+ get => Volatile.Read(ref s_hiddenLastKnownFreeAddressSpace);
+ set => Volatile.Write(ref s_hiddenLastKnownFreeAddressSpace, value);
}
- private static long AddToLastKnownFreeAddressSpace(long addend)
- {
- return Interlocked.Add(ref s_hiddenLastKnownFreeAddressSpace, addend);
- }
+ private static long AddToLastKnownFreeAddressSpace(long addend) =>
+ Interlocked.Add(ref s_hiddenLastKnownFreeAddressSpace, addend);
private static long LastTimeCheckingAddressSpace
{
- get { return Volatile.Read(ref s_hiddenLastTimeCheckingAddressSpace); }
- set { Volatile.Write(ref s_hiddenLastTimeCheckingAddressSpace, value); }
+ get => Volatile.Read(ref s_hiddenLastTimeCheckingAddressSpace);
+ set => Volatile.Write(ref s_hiddenLastTimeCheckingAddressSpace, value);
}
// When allocating memory segment by segment, we've hit some cases
*/
}
- internal static long AddMemoryFailPointReservation(long size)
- {
+ internal static long AddMemoryFailPointReservation(long size) =>
// Size can legitimately be negative - see Dispose.
- return Interlocked.Add(ref s_failPointReservedMemory, (long)size);
- }
+ Interlocked.Add(ref s_failPointReservedMemory, (long)size);
internal static ulong MemoryFailPointReservedMemory
{
public int VersionAdded
{
- get { return _versionAdded; }
+ get => _versionAdded;
set
{
if (value < 1)
public string FullTypeName
{
- get { return _rootTypeName; }
+ get => _rootTypeName;
set
{
if (null == value)
public string AssemblyName
{
- get { return _rootTypeAssemblyName; }
+ get => _rootTypeAssemblyName;
set
{
if (null == value)
public string? FrameworkDisplayName
{
- get { return _frameworkDisplayName; }
- set { _frameworkDisplayName = value; }
+ get => _frameworkDisplayName;
+ set => _frameworkDisplayName = value;
}
}
}
public string Tag
{
- get
- {
- return _tag;
- }
-
+ get => _tag;
set
{
if (value == null)
public string? Text
{
- get
- {
- return Unescape(_text);
- }
-
+ get => Unescape(_text);
set
{
if (value == null)
}
[NonVersionable]
- public static bool operator ==(float left, float right)
- {
- return left == right;
- }
+ public static bool operator ==(float left, float right) => left == right;
[NonVersionable]
- public static bool operator !=(float left, float right)
- {
- return left != right;
- }
+ public static bool operator !=(float left, float right) => left != right;
[NonVersionable]
- public static bool operator <(float left, float right)
- {
- return left < right;
- }
+ public static bool operator <(float left, float right) => left < right;
[NonVersionable]
- public static bool operator >(float left, float right)
- {
- return left > right;
- }
+ public static bool operator >(float left, float right) => left > right;
[NonVersionable]
- public static bool operator <=(float left, float right)
- {
- return left <= right;
- }
+ public static bool operator <=(float left, float right) => left <= right;
[NonVersionable]
- public static bool operator >=(float left, float right)
- {
- return left >= right;
- }
+ public static bool operator >=(float left, float right) => left >= right;
public override bool Equals(object? obj)
{
/// Returns true if left and right point at the same memory and have the same length. Note that
/// this does *not* check to see if the *contents* are equal.
/// </summary>
- public static bool operator ==(Span<T> left, Span<T> right)
- {
- return left._length == right._length && Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
- }
+ public static bool operator ==(Span<T> left, Span<T> right) =>
+ left._length == right._length &&
+ Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
/// <summary>
/// Defines an implicit conversion of a <see cref="Span{T}"/> to a <see cref="ReadOnlySpan{T}"/>
/// </summary>
- public static implicit operator ReadOnlySpan<T>(Span<T> span) => new ReadOnlySpan<T>(ref span._pointer.Value, span._length);
+ public static implicit operator ReadOnlySpan<T>(Span<T> span) =>
+ new ReadOnlySpan<T>(ref span._pointer.Value, span._length);
/// <summary>
/// For <see cref="Span{Char}"/>, returns a new instance of string that represents the characters pointed to by the span.
public int Length
{
[NonVersionable]
- get
- {
- return _length;
- }
+ get => _length;
}
/// <summary>
public bool IsEmpty
{
[NonVersionable]
- get
- {
- // Workaround for https://github.com/dotnet/coreclr/issues/19620
- return 0 >= (uint)_length;
- }
+ get => 0 >= (uint)_length; // Workaround for https://github.com/dotnet/coreclr/issues/19620
}
/// <summary>
/// </summary>
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object? obj)
- {
+ public override bool Equals(object? obj) =>
throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
- }
/// <summary>
/// This method is not supported as spans cannot be boxed.
/// </summary>
[Obsolete("GetHashCode() on Span will always throw an exception.")]
[EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode()
- {
+ public override int GetHashCode() =>
throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
- }
/// <summary>
/// Defines an implicit conversion of an array to a <see cref="Span{T}"/>
/// <summary>
/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Span{T}"/>
/// </summary>
- public static implicit operator Span<T>(ArraySegment<T> segment)
- => new Span<T>(segment.Array, segment.Offset, segment.Count);
+ public static implicit operator Span<T>(ArraySegment<T> segment) =>
+ new Span<T>(segment.Array, segment.Offset, segment.Count);
/// <summary>
/// Returns an empty <see cref="Span{T}"/>
}
}
- public static bool operator ==(string? a, string? b)
- {
- return string.Equals(a, b);
- }
+ public static bool operator ==(string? a, string? b) => string.Equals(a, b);
- public static bool operator !=(string? a, string? b)
- {
- return !string.Equals(a, b);
- }
+ public static bool operator !=(string? a, string? b) => !string.Equals(a, b);
// Gets a hash code for this string. If strings A and B are such that A.Equals(B), then
// they will return the same hash code.
public DecoderFallback? Fallback
{
- get
- {
- return _fallback;
- }
-
+ get => _fallback;
set
{
if (value == null)
public EncoderFallback? Fallback
{
- get
- {
- return _fallback;
- }
-
+ get => _fallback;
set
{
if (value == null)
public EncoderFallback EncoderFallback
{
- get
- {
- return encoderFallback;
- }
-
+ get => encoderFallback;
set
{
if (this.IsReadOnly)
public DecoderFallback DecoderFallback
{
- get
- {
- return decoderFallback;
- }
-
+ get => decoderFallback;
set
{
if (this.IsReadOnly)
public bool IsReadOnly
{
- get
- {
- return (_isReadOnly);
- }
- private protected set
- {
- _isReadOnly = value;
- }
+ get => (_isReadOnly);
+ private protected set => _isReadOnly = value;
}
// Returns an encoding for the ASCII character set. The returned encoding
public int Capacity
{
- get { return m_ChunkChars.Length + m_ChunkOffset; }
+ get => m_ChunkChars.Length + m_ChunkOffset;
set
{
if (value < 0)
/// </summary>
public int Length
{
- get
- {
- return m_ChunkOffset + m_ChunkLength;
- }
+ get => m_ChunkOffset + m_ChunkLength;
set
{
// If the new length is less than 0 or greater than our Maximum capacity, bail.
object? obj = ExecutionContext.GetLocalValue(this);
return (obj == null) ? default : (T)obj;
}
- set
- {
- ExecutionContext.SetLocalValue(this, value, m_valueChangedHandler != null);
- }
+ set => ExecutionContext.SetLocalValue(this, value, m_valueChangedHandler != null);
}
void IAsyncLocal.OnValueChanged(object? previousValueObj, object? currentValueObj, bool contextChanged)
return _thread?.GetHashCode() ?? 0;
}
- public static bool operator ==(AsyncFlowControl a, AsyncFlowControl b)
- {
- return a.Equals(b);
- }
+ public static bool operator ==(AsyncFlowControl a, AsyncFlowControl b) => a.Equals(b);
- public static bool operator !=(AsyncFlowControl a, AsyncFlowControl b)
- {
- return !(a == b);
- }
+ public static bool operator !=(AsyncFlowControl a, AsyncFlowControl b) => !(a == b);
}
}
/// <value>true if the event has is set; otherwise, false.</value>
public bool IsSet
{
- get
- {
- return 0 != ExtractStatePortion(m_combinedState, SignalledState_BitMask);
- }
-
- private set
- {
- UpdateStateAtomically(((value) ? 1 : 0) << SignalledState_ShiftCount, SignalledState_BitMask);
- }
+ get => 0 != ExtractStatePortion(m_combinedState, SignalledState_BitMask);
+ private set => UpdateStateAtomically(((value) ? 1 : 0) << SignalledState_ShiftCount, SignalledState_BitMask);
}
/// <summary>
/// </summary>
public int SpinCount
{
- get
- {
- return ExtractStatePortionAndShiftRight(m_combinedState, SpinCountState_BitMask, SpinCountState_ShiftCount);
- }
-
+ get => ExtractStatePortionAndShiftRight(m_combinedState, SpinCountState_BitMask, SpinCountState_ShiftCount);
private set
{
Debug.Assert(value >= 0, "SpinCount is a restricted-width integer. The value supplied is outside the legal range.");
/// </summary>
private int Waiters
{
- get
- {
- return ExtractStatePortionAndShiftRight(m_combinedState, NumWaitersState_BitMask, NumWaitersState_ShiftCount);
- }
-
+ get => ExtractStatePortionAndShiftRight(m_combinedState, NumWaitersState_BitMask, NumWaitersState_ShiftCount);
set
{
// setting to <0 would indicate an internal flaw, hence Assert is appropriate.
internal bool IsWaitNotificationEnabledOrNotRanToCompletion
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return (m_stateFlags & (Task.TASK_STATE_WAIT_COMPLETION_NOTIFICATION | Task.TASK_STATE_RAN_TO_COMPLETION))
+ get => (m_stateFlags & (Task.TASK_STATE_WAIT_COMPLETION_NOTIFICATION | Task.TASK_STATE_RAN_TO_COMPLETION))
!= Task.TASK_STATE_RAN_TO_COMPLETION;
- }
}
/// <summary>
[Obsolete("The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)]
public ApartmentState ApartmentState
{
- get
- {
- return GetApartmentState();
- }
- set
- {
- TrySetApartmentState(value);
- }
+ get => GetApartmentState();
+ set => TrySetApartmentState(value);
}
public void SetApartmentState(ApartmentState state)
[Obsolete("Use the SafeWaitHandle property instead.")]
public virtual IntPtr Handle
{
- get
- {
- return _waitHandle == null ? InvalidHandle : _waitHandle.DangerousGetHandle();
- }
+ get => _waitHandle == null ? InvalidHandle : _waitHandle.DangerousGetHandle();
set
{
if (value == InvalidHandle)
[AllowNull]
public SafeWaitHandle SafeWaitHandle
{
- get
- {
- if (_waitHandle == null)
- {
- _waitHandle = new SafeWaitHandle(InvalidHandle, false);
- }
- return _waitHandle;
- }
- set
- {
- _waitHandle = value;
- }
+ get => _waitHandle ??= new SafeWaitHandle(InvalidHandle, false);
+ set => _waitHandle = value;
}
internal static int ToTimeoutMilliseconds(TimeSpan timeout)
return new TimeSpan(-t._ticks);
}
- public static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
- {
- return t1.Subtract(t2);
- }
+ public static TimeSpan operator -(TimeSpan t1, TimeSpan t2) => t1.Subtract(t2);
- public static TimeSpan operator +(TimeSpan t)
- {
- return t;
- }
+ public static TimeSpan operator +(TimeSpan t) => t;
- public static TimeSpan operator +(TimeSpan t1, TimeSpan t2)
- {
- return t1.Add(t2);
- }
+ public static TimeSpan operator +(TimeSpan t1, TimeSpan t2) => t1.Add(t2);
public static TimeSpan operator *(TimeSpan timeSpan, double factor)
{
// is perhaps less useful, but no less useful than an exception.
public static double operator /(TimeSpan t1, TimeSpan t2) => t1.Ticks / (double)t2.Ticks;
- public static bool operator ==(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks == t2._ticks;
- }
+ public static bool operator ==(TimeSpan t1, TimeSpan t2) => t1._ticks == t2._ticks;
- public static bool operator !=(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks != t2._ticks;
- }
+ public static bool operator !=(TimeSpan t1, TimeSpan t2) => t1._ticks != t2._ticks;
- public static bool operator <(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks < t2._ticks;
- }
+ public static bool operator <(TimeSpan t1, TimeSpan t2) => t1._ticks < t2._ticks;
- public static bool operator <=(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks <= t2._ticks;
- }
+ public static bool operator <=(TimeSpan t1, TimeSpan t2) => t1._ticks <= t2._ticks;
- public static bool operator >(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks > t2._ticks;
- }
+ public static bool operator >(TimeSpan t1, TimeSpan t2) => t1._ticks > t2._ticks;
- public static bool operator >=(TimeSpan t1, TimeSpan t2)
- {
- return t1._ticks >= t2._ticks;
- }
+ public static bool operator >=(TimeSpan t1, TimeSpan t2) => t1._ticks >= t2._ticks;
}
}
return false;
}
- unsafe bool IEquatable<UIntPtr>.Equals(UIntPtr other)
- {
- return _value == other._value;
- }
+ unsafe bool IEquatable<UIntPtr>.Equals(UIntPtr other) =>
+ _value == other._value;
public override unsafe int GetHashCode()
{
[Intrinsic]
[NonVersionable]
- public unsafe ulong ToUInt64()
- {
- return (ulong)_value;
- }
+ public unsafe ulong ToUInt64() => (ulong)_value;
[Intrinsic]
[NonVersionable]
- public static explicit operator UIntPtr(uint value)
- {
- return new UIntPtr(value);
- }
+ public static explicit operator UIntPtr(uint value) =>
+ new UIntPtr(value);
[Intrinsic]
[NonVersionable]
- public static explicit operator UIntPtr(ulong value)
- {
- return new UIntPtr(value);
- }
+ public static explicit operator UIntPtr(ulong value) =>
+ new UIntPtr(value);
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator UIntPtr(void* value)
- {
- return new UIntPtr(value);
- }
+ public static unsafe explicit operator UIntPtr(void* value) =>
+ new UIntPtr(value);
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator void*(UIntPtr value)
- {
- return value._value;
- }
+ public static unsafe explicit operator void*(UIntPtr value) =>
+ value._value;
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator uint(UIntPtr value)
- {
+ public static unsafe explicit operator uint(UIntPtr value) =>
#if BIT64
- return checked((uint)value._value);
+ checked((uint)value._value);
#else
- return (uint)value._value;
+ (uint)value._value;
#endif
- }
+
[Intrinsic]
[NonVersionable]
- public static unsafe explicit operator ulong(UIntPtr value)
- {
- return (ulong)value._value;
- }
+ public static unsafe explicit operator ulong(UIntPtr value) =>
+ (ulong)value._value;
[Intrinsic]
[NonVersionable]
- public static unsafe bool operator ==(UIntPtr value1, UIntPtr value2)
- {
- return value1._value == value2._value;
- }
+ public static unsafe bool operator ==(UIntPtr value1, UIntPtr value2) =>
+ value1._value == value2._value;
[Intrinsic]
[NonVersionable]
- public static unsafe bool operator !=(UIntPtr value1, UIntPtr value2)
- {
- return value1._value != value2._value;
- }
+ public static unsafe bool operator !=(UIntPtr value1, UIntPtr value2) =>
+ value1._value != value2._value;
[NonVersionable]
- public static UIntPtr Add(UIntPtr pointer, int offset)
- {
- return pointer + offset;
- }
+ public static UIntPtr Add(UIntPtr pointer, int offset) =>
+ pointer + offset;
[Intrinsic]
[NonVersionable]
- public static unsafe UIntPtr operator +(UIntPtr pointer, int offset)
- {
- return new UIntPtr((nuint)pointer._value + (nuint)offset);
- }
+ public static unsafe UIntPtr operator +(UIntPtr pointer, int offset) =>
+ new UIntPtr((nuint)pointer._value + (nuint)offset);
[NonVersionable]
- public static UIntPtr Subtract(UIntPtr pointer, int offset)
- {
- return pointer - offset;
- }
+ public static UIntPtr Subtract(UIntPtr pointer, int offset) =>
+ pointer - offset;
[Intrinsic]
[NonVersionable]
- public static unsafe UIntPtr operator -(UIntPtr pointer, int offset)
- {
- return new UIntPtr((nuint)pointer._value - (nuint)offset);
- }
+ public static unsafe UIntPtr operator -(UIntPtr pointer, int offset) =>
+ new UIntPtr((nuint)pointer._value - (nuint)offset);
public static int Size
{
[Intrinsic]
[NonVersionable]
- get
- {
- return sizeof(nuint);
- }
+ get => sizeof(nuint);
}
[Intrinsic]
[NonVersionable]
- public unsafe void* ToPointer()
- {
- return _value;
- }
+ public unsafe void* ToPointer() => _value;
- public override unsafe string ToString()
- {
- return ((nuint)_value).ToString(CultureInfo.InvariantCulture);
- }
+ public override unsafe string ToString() =>
+ ((nuint)_value).ToString(CultureInfo.InvariantCulture);
}
}
return ReferenceEquals(v2, v1) ? true : v2.Equals(v1);
}
- public static bool operator !=(Version? v1, Version? v2)
- {
- return !(v1 == v2);
- }
+ public static bool operator !=(Version? v1, Version? v2) => !(v1 == v2);
public static bool operator <(Version? v1, Version? v2)
{
return (v1.CompareTo(v2) <= 0);
}
- public static bool operator >(Version? v1, Version? v2)
- {
- return (v2 < v1);
- }
+ public static bool operator >(Version? v1, Version? v2) => (v2 < v1);
- public static bool operator >=(Version? v1, Version? v2)
- {
- return (v2 <= v1);
- }
+ public static bool operator >=(Version? v1, Version? v2) => (v2 <= v1);
}
}