diff --git a/src/CuteUtils/FluentMath/Shapes/Circle.cs b/src/CuteUtils/FluentMath/Shapes/Circle.cs
index bb9d3c3..151ff00 100644
--- a/src/CuteUtils/FluentMath/Shapes/Circle.cs
+++ b/src/CuteUtils/FluentMath/Shapes/Circle.cs
@@ -1,12 +1,31 @@
namespace CuteUtils.FluentMath.Shapes;
+///
+/// Represents a circle shape.
+///
+///
+/// Initializes a new instance of the class with the specified radius.
+///
+/// The radius of the circle.
public class Circle(double radius)
{
+ ///
+ /// Gets or sets the radius of the circle.
+ ///
public double Radius { get; set; } = radius;
+ ///
+ /// Gets the diameter of the circle.
+ ///
public double Diameter => Radius * 2;
+ ///
+ /// Gets the circumference of the circle.
+ ///
public double Circumference => 2 * Math.PI * Radius;
+ ///
+ /// Gets the area of the circle.
+ ///
public double Area => Math.PI * Math.Pow(Radius, 2);
}
\ No newline at end of file
diff --git a/src/CuteUtils/FluentMath/Shapes/Ellipse.cs b/src/CuteUtils/FluentMath/Shapes/Ellipse.cs
index e4963ab..f6df592 100644
--- a/src/CuteUtils/FluentMath/Shapes/Ellipse.cs
+++ b/src/CuteUtils/FluentMath/Shapes/Ellipse.cs
@@ -1,12 +1,37 @@
namespace CuteUtils.FluentMath.Shapes;
+///
+/// Represents an ellipse shape.
+///
+///
+/// Initializes a new instance of the class with the specified major and minor axes.
+///
+/// The length of the major axis.
+/// The length of the minor axis.
public class Ellipse(double majorAxis, double minorAxis)
{
+ ///
+ /// Gets or sets the length of the major axis.
+ ///
public double MajorAxis { get; set; } = majorAxis;
+
+ ///
+ /// Gets or sets the length of the minor axis.
+ ///
public double MinorAxis { get; set; } = minorAxis;
+ ///
+ /// Gets the area of the ellipse.
+ ///
public double Area => Math.PI * MajorAxis * MinorAxis;
+
+ ///
+ /// Gets the circumference of the ellipse.
+ ///
public double Circumference => Math.PI * ((3 * (MajorAxis + MinorAxis)) - Math.Sqrt(((3 * MajorAxis) + MinorAxis) * (MajorAxis + (3 * MinorAxis))));
+ ///
+ /// Gets a value indicating whether the ellipse is a circle.
+ ///
public bool IsCircle => MajorAxis == MinorAxis;
}
\ No newline at end of file
diff --git a/src/CuteUtils/FluentMath/Shapes/Rectangle.cs b/src/CuteUtils/FluentMath/Shapes/Rectangle.cs
index d67a204..d74abe7 100644
--- a/src/CuteUtils/FluentMath/Shapes/Rectangle.cs
+++ b/src/CuteUtils/FluentMath/Shapes/Rectangle.cs
@@ -1,42 +1,52 @@
namespace CuteUtils.FluentMath.Shapes;
///
-/// Represents a rectangle
+/// Represents a rectangle shape.
///
///
-/// Creates a new rectangle instance
+/// Initializes a new instance of the class with the specified length and width.
///
-/// The length of the rectangle
-/// The width of the rectangle
+/// The length of the rectangle.
+/// The width of the rectangle.
public class Rectangle(double length, double width)
{
///
- /// The length of the
+ /// Gets or sets the length of the rectangle.
///
public double Length { get; set; } = length;
///
- /// The width of the
+ /// Gets or sets the width of the rectangle.
///
public double Width { get; set; } = width;
///
- /// The diagonal of the
+ /// Gets the diagonal length of the rectangle.
///
public double Diagonal => Math.Sqrt(Math.Pow(Length, 2) + Math.Pow(Width, 2));
///
- /// The area of the
+ /// Gets the area of the rectangle.
///
public double Area => Length * Width;
///
- /// The perimeter of the
+ /// Gets the perimeter of the rectangle.
///
public double Perimeter => (Length * 2) + (Width * 2);
+ ///
+ /// Gets a value indicating whether the rectangle is a square.
+ ///
public bool IsSquare => Length == Width;
+
+ ///
+ /// Gets a value indicating whether the rectangle is a rectangle (not a square).
+ ///
public bool IsRectangle => !IsSquare;
+ ///
+ /// Gets a value indicating whether the rectangle has a golden ratio.
+ ///
public bool IsGolden => Length / Width == 1.61803398875;
}
\ No newline at end of file
diff --git a/src/CuteUtils/FluentMath/Shapes/Triangle.cs b/src/CuteUtils/FluentMath/Shapes/Triangle.cs
index 4a25927..b7fbb74 100644
--- a/src/CuteUtils/FluentMath/Shapes/Triangle.cs
+++ b/src/CuteUtils/FluentMath/Shapes/Triangle.cs
@@ -1,11 +1,34 @@
namespace CuteUtils.FluentMath.Shapes;
+///
+/// Represents a triangle with three sides.
+///
+///
+/// Initializes a new instance of the class with the specified side lengths.
+///
+/// The length of side A.
+/// The length of side B.
+/// The length of side C.
public class Triangle(double sideA, double sideB, double sideC)
{
+ ///
+ /// Gets or sets the length of side A.
+ ///
public double SideA { get; set; } = sideA;
+
+ ///
+ /// Gets or sets the length of side B.
+ ///
public double SideB { get; set; } = sideB;
+
+ ///
+ /// Gets or sets the length of side C.
+ ///
public double SideC { get; set; } = sideC;
+ ///
+ /// Gets the area of the triangle.
+ ///
public double Area
{
get
@@ -15,8 +38,14 @@ public class Triangle(double sideA, double sideB, double sideC)
}
}
+ ///
+ /// Gets the perimeter of the triangle.
+ ///
public double Perimeter => SideA + SideB + SideC;
+ ///
+ /// Gets a value indicating whether the triangle is right-angled.
+ ///
public bool IsRightAngled
{
get
@@ -27,9 +56,18 @@ public class Triangle(double sideA, double sideB, double sideC)
}
}
+ ///
+ /// Gets a value indicating whether the triangle is equilateral.
+ ///
public bool IsEquilateral => SideA == SideB && SideB == SideC;
+ ///
+ /// Gets a value indicating whether the triangle is isosceles.
+ ///
public bool IsIsosceles => SideA == SideB || SideB == SideC || SideA == SideC;
+ ///
+ /// Gets a value indicating whether the triangle is scalene.
+ ///
public bool IsScalene => !IsEquilateral && !IsIsosceles;
}
\ No newline at end of file
diff --git a/src/CuteUtils/Reflection/DynDto.cs b/src/CuteUtils/Reflection/DynDto.cs
index 8f3c883..c9fe6db 100644
--- a/src/CuteUtils/Reflection/DynDto.cs
+++ b/src/CuteUtils/Reflection/DynDto.cs
@@ -3,8 +3,16 @@ using System.Reflection;
namespace CuteUtils.Reflection;
+///
+/// Provides utility methods for converting objects to and from dynamic DTOs.
+///
public static class DynDto
{
+ ///
+ /// Converts an object to a dynamic DTO.
+ ///
+ /// The object to convert.
+ /// The dynamic DTO.
public static ExpandoObject ToDto(this object data)
{
ExpandoObject dto = new ExpandoObject();
@@ -24,6 +32,13 @@ public static class DynDto
return dto;
}
+ ///
+ /// Converts an object to a specified type of DTO.
+ ///
+ /// The type of DTO.
+ /// The object to convert.
+ /// The DTO instance to populate.
+ /// The populated DTO.
public static T ToDto(this object data, T dto)
{
ArgumentNullException.ThrowIfNull(dto);
@@ -46,11 +61,24 @@ public static class DynDto
return dto;
}
+ ///
+ /// Converts an object to a new instance of a specified type of DTO.
+ ///
+ /// The type of DTO.
+ /// The object to convert.
+ /// The new instance of the DTO.
public static T ToDto(this object data) where T : new()
{
return ToDto(data, new T());
}
+ ///
+ /// Converts a dynamic DTO to an object.
+ ///
+ /// The type of object.
+ /// The dynamic DTO.
+ /// The object instance to populate.
+ /// The populated object.
public static T FromDto(this object dto, T data)
{
ArgumentNullException.ThrowIfNull(data);
@@ -75,6 +103,13 @@ public static class DynDto
return data;
}
+ ///
+ /// Converts a dynamic DTO to an object.
+ ///
+ /// The type of object.
+ /// The dynamic DTO.
+ /// The new instance of the object.
+ /// The populated object.
public static T FromDto(this ExpandoObject dto, T data)
{
ArgumentNullException.ThrowIfNull(dto);
@@ -96,11 +131,23 @@ public static class DynDto
return data;
}
+ ///
+ /// Converts a dynamic DTO to a new instance of an object.
+ ///
+ /// The type of object.
+ /// The dynamic DTO.
+ /// The new instance of the object.
public static T FromDto(this object dto) where T : new()
{
return FromDto(dto, new T());
}
+ ///
+ /// Converts a dynamic DTO to a new instance of an object.
+ ///
+ /// The type of object.
+ /// The dynamic DTO.
+ /// The new instance of the object.
public static T FromDto(this ExpandoObject dto) where T : new()
{
return FromDto(dto, new T());
diff --git a/src/CuteUtils/Reflection/DynDtoNameAttribute.cs b/src/CuteUtils/Reflection/DynDtoNameAttribute.cs
index 475350f..4e1a84e 100644
--- a/src/CuteUtils/Reflection/DynDtoNameAttribute.cs
+++ b/src/CuteUtils/Reflection/DynDtoNameAttribute.cs
@@ -1,6 +1,17 @@
namespace CuteUtils.Reflection;
+
+///
+/// Represents an attribute that specifies the dynamic DTO name for a property.
+///
+///
+/// Initializes a new instance of the class with the specified name.
+///
+/// The dynamic DTO name.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class DynDtoNameAttribute(string name) : Attribute
{
+ ///
+ /// Gets or sets the dynamic DTO name.
+ ///
public string Name { get; set; } = name;
-}
+}
\ No newline at end of file
diff --git a/src/CuteUtils/Reflection/ReflectionExtentions.cs b/src/CuteUtils/Reflection/ReflectionExtentions.cs
index 8459a45..4f7bb7e 100644
--- a/src/CuteUtils/Reflection/ReflectionExtentions.cs
+++ b/src/CuteUtils/Reflection/ReflectionExtentions.cs
@@ -3,16 +3,16 @@
namespace CuteUtils.Reflection;
///
-/// Reflection class
+/// Provides extension methods for reflection operations.
///
public static class ReflectionExtentions
{
///
- /// Copies all properties of an object to a new one.
+ /// Creates a new instance of the specified type and copies the properties from the source object to the new instance.
///
- ///
- ///
- ///
+ /// The type of the new instance.
+ /// The source object.
+ /// A new instance of the specified type with copied properties.
public static T CopyProperties(this object obj) where T : new()
{
T newObj = new T();
@@ -33,12 +33,13 @@ public static class ReflectionExtentions
}
///
- /// Copies all properties of an object to a different one.
+ /// Copies the properties from the source object to the specified target object.
///
- ///
- ///
- ///
- ///
+ /// The type of the target object.
+ /// The source object.
+ /// The target object.
+ /// The target object with copied properties.
+ /// Thrown when the target object is null.
public static T CopyProperties(this object obj, T newObj)
{
ArgumentNullException.ThrowIfNull(newObj);