simplify new expression

This commit is contained in:
NaBian committed 2021-06-08 20:35:14 +08:00
1 parent 42b2cb3033
commit 193090da43
59 files changed
+149 -149

No files matched your search

@@ -30,13 +30,13 @@ namespace HandyControl.Tools.Interop
[SecurityCritical]
internal HandleRef MakeHandleRef(object obj)
{
return new HandleRef(obj, handle);
return new(obj, handle);
}
[SecurityCritical]
internal static BitmapHandle CreateFromHandle(IntPtr hbitmap, bool ownsHandle = true)
{
return new BitmapHandle(ownsHandle)
return new(ownsHandle)
{
handle = hbitmap,
};
@@ -10,7 +10,7 @@ namespace HandyControl.Tools.Interop
private static HandleType[] HandleTypes;
private static int HandleTypeCount;
private static readonly object HandleMutex = new object();
private static readonly object HandleMutex = new();
internal static IntPtr Add(IntPtr handle, int type)
{
@@ -21,7 +21,7 @@ namespace HandyControl.Tools.Interop
[SecurityCritical, SecuritySafeCritical]
internal static IconHandle GetInvalidIcon()
{
return new IconHandle();
return new();
}
[SecurityCritical]
@@ -19,7 +19,7 @@ namespace HandyControl.Tools.Interop
internal const int E_FAIL = unchecked((int) 0x80004005);
internal static readonly IntPtr HRGN_NONE = new IntPtr(-1);
internal static readonly IntPtr HRGN_NONE = new(-1);
[DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
[ResourceExposure(ResourceScope.None)]
@@ -240,8 +240,8 @@ namespace HandyControl.Tools.Interop
Bottom = (int) rect.Bottom;
}
public Point Position => new Point(Left, Top);
public Size Size => new Size(Width, Height);
public Point Position => new(Left, Top);
public Size Size => new(Width, Height);
public int Height
{