I have a need to create a quick class with just 2 properties (left and top), I'll then call these in a collection.
Is there a quick way to create the class structure without having to actually create the strongly typed class itself using generics?
Thanks in advance
Better still, does the framwework have a built in type than can just store left, top, right, bottom co-ordinates in integer values?
Automatic Properties would help make this quick
public class Position<T> where T: struct
{
public T Top { get; set; }
public T Left { get; set; }
}
Or you might want to check out the Point or Rectangle classes in the System.Drawing namespace.
I think you're looking for System.Drawing.Rectangle
(which is a struct, not a class by the way; there's a class in System.Windows.Shapes
but that's different.) There's no point in creating a new generic type when what you want is already in the framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With