Skip to content

Commit

Permalink
Merge pull request #801 from ds5678/primitive-implicit-conversions
Browse files Browse the repository at this point in the history
Implicit Conversions to System.Drawing structs
  • Loading branch information
FlorianRappl committed Apr 29, 2024
2 parents d225324 + 4be5cef commit 5125ee0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ElectronNET.API/Entities/Point.cs
Expand Up @@ -20,5 +20,14 @@ public class Point
/// The y.
/// </value>
public int Y { get; set; }

/// <summary>
/// Convert this <see cref="Point"/> to <see cref="System.Drawing.Point"/>.
/// </summary>
/// <param name="point">The point.</param>
public static implicit operator System.Drawing.Point(Point point)
{
return new System.Drawing.Point(point.X, point.Y);
}
}
}
9 changes: 9 additions & 0 deletions src/ElectronNET.API/Entities/Rectangle.cs
Expand Up @@ -36,5 +36,14 @@ public class Rectangle
/// The height.
/// </value>
public int Height { get; set; }

/// <summary>
/// Convert this <see cref="Rectangle"/> to <see cref="System.Drawing.Rectangle"/>.
/// </summary>
/// <param name="rectangle">The rectangle.</param>
public static implicit operator System.Drawing.Rectangle(Rectangle rectangle)
{
return new System.Drawing.Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
}
}
}
9 changes: 9 additions & 0 deletions src/ElectronNET.API/Entities/Size.cs
Expand Up @@ -20,5 +20,14 @@ public class Size
/// The height.
/// </value>
public int Height { get; set; }

/// <summary>
/// Convert this <see cref="Size"/> to <see cref="System.Drawing.Size"/>.
/// </summary>
/// <param name="size">The size.</param>
public static implicit operator System.Drawing.Size(Size size)
{
return new System.Drawing.Size(size.Width, size.Height);
}
}
}

0 comments on commit 5125ee0

Please sign in to comment.