mirror of https://github.com/dahall/Vanara.git
Updated with expressions
parent
162dccdd63
commit
cf50f7203f
|
@ -6829,7 +6829,7 @@ public static partial class AdvApi32
|
||||||
public static TRACEHANDLE NULL => new(0);
|
public static TRACEHANDLE NULL => new(0);
|
||||||
|
|
||||||
/// <summary>Gets a value indicating whether this instance is invalid.</summary>
|
/// <summary>Gets a value indicating whether this instance is invalid.</summary>
|
||||||
public bool IsInvalid => handle == 0 || handle == 0x00000000FFFFFFFF;
|
public bool IsInvalid => handle is 0 or 0x00000000FFFFFFFF;
|
||||||
|
|
||||||
/// <summary>Gets a value indicating whether this instance is a null handle.</summary>
|
/// <summary>Gets a value indicating whether this instance is a null handle.</summary>
|
||||||
public bool IsNull => handle == 0;
|
public bool IsNull => handle == 0;
|
||||||
|
@ -7025,7 +7025,7 @@ public static partial class AdvApi32
|
||||||
|
|
||||||
/// <summary>Gets a value indicating whether this instance is invalid.</summary>
|
/// <summary>Gets a value indicating whether this instance is invalid.</summary>
|
||||||
/// <value><c>true</c> if this instance is invalid; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is invalid; otherwise, <c>false</c>.</value>
|
||||||
public bool IsInvalid => handle == 0 || handle == 0x00000000FFFFFFFF;
|
public bool IsInvalid => handle is 0 or 0x00000000FFFFFFFF;
|
||||||
|
|
||||||
/// <summary>Performs an implicit conversion from <see cref="SafeTRACEHANDLE"/> to <see cref="TRACEHANDLE"/>.</summary>
|
/// <summary>Performs an implicit conversion from <see cref="SafeTRACEHANDLE"/> to <see cref="TRACEHANDLE"/>.</summary>
|
||||||
/// <param name="h">The safe handle instance.</param>
|
/// <param name="h">The safe handle instance.</param>
|
||||||
|
|
|
@ -18,7 +18,7 @@ public struct CY : IEquatable<CY>, IComparable<CY>, IEquatable<decimal>, ICompar
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
public CY(long value)
|
public CY(long value)
|
||||||
{
|
{
|
||||||
if (value > (long.MaxValue / 10000) || value < (long.MinValue / 10000))
|
if (value is > (long.MaxValue / 10000) or < (long.MinValue / 10000))
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
int64 = value * 10000;
|
int64 = value * 10000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public struct COLORREF : IEquatable<COLORREF>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public COLORREF Darken(float percent)
|
public COLORREF Darken(float percent)
|
||||||
{
|
{
|
||||||
return percent < 0 || percent > 1.0
|
return percent is < 0 or > (float)1.0
|
||||||
? throw new ArgumentOutOfRangeException(nameof(percent))
|
? throw new ArgumentOutOfRangeException(nameof(percent))
|
||||||
: (new(Conv(R), Conv(G), Conv(B)) { Value = Value });
|
: (new(Conv(R), Conv(G), Conv(B)) { Value = Value });
|
||||||
byte Conv(byte c) => (byte)(c - (int)(c * percent));
|
byte Conv(byte c) => (byte)(c - (int)(c * percent));
|
||||||
|
@ -96,7 +96,7 @@ public struct COLORREF : IEquatable<COLORREF>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public COLORREF Lighten(float percent)
|
public COLORREF Lighten(float percent)
|
||||||
{
|
{
|
||||||
return percent < 0 || percent > 1.0
|
return percent is < 0 or > (float)1.0
|
||||||
? throw new ArgumentOutOfRangeException(nameof(percent))
|
? throw new ArgumentOutOfRangeException(nameof(percent))
|
||||||
: (new(Conv(R), Conv(G), Conv(B)) { Value = Value });
|
: (new(Conv(R), Conv(G), Conv(B)) { Value = Value });
|
||||||
byte Conv(byte c) => (byte)(c + (int)((255f - c) * percent));
|
byte Conv(byte c) => (byte)(c + (int)((255f - c) * percent));
|
||||||
|
|
|
@ -407,7 +407,7 @@ public struct LOGFONT
|
||||||
public short lfWeight
|
public short lfWeight
|
||||||
{
|
{
|
||||||
get => (short)_lfWeight;
|
get => (short)_lfWeight;
|
||||||
set => _lfWeight = value >= 0 && value <= 1000 ? value : throw new ArgumentOutOfRangeException(nameof(lfWeight), @"Font weight must be a value in the range 0 through 1000.");
|
set => _lfWeight = value is >= 0 and <= 1000 ? value : throw new ArgumentOutOfRangeException(nameof(lfWeight), @"Font weight must be a value in the range 0 through 1000.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets or sets the font pitch.</summary>
|
/// <summary>Gets or sets the font pitch.</summary>
|
||||||
|
|
|
@ -214,13 +214,13 @@ public class ValidHandleConstraint : OpConstraint
|
||||||
case IHandle ih:
|
case IHandle ih:
|
||||||
val = ih.DangerousGetHandle();
|
val = ih.DangerousGetHandle();
|
||||||
var l = val.ToInt64();
|
var l = val.ToInt64();
|
||||||
success = l != 0 && l != -1;
|
success = l is not 0 and not (-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntPtr p:
|
case IntPtr p:
|
||||||
val = p;
|
val = p;
|
||||||
l = val.ToInt64();
|
l = val.ToInt64();
|
||||||
success = l != 0 && l != -1;
|
success = l is not 0 and not (-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue