C# Organize variables? -
in c# there way make similar struct created when new instances of object created? here example. want people able assign events, problem there lot of events assign, , have similar functionality, different object. example, left button down event, right button down event, etc. etc. thought organize these structs but, ran snag when found structs considered "static" , not able access non-static members. there sort of structure let me in c#.
(the end result should let me make new object, , assign objects event through these structures)
mouseobject mouse = new mouseobject(); mouse.left.pressedevent += somemethod();
in example left cannot struct since used in non-static instance.
why not use class?
class mousebutton { public someevent pressedevent; } class mouseobject { public mousebutton left { get; } public mousebutton right { get; } }
Comments
Post a Comment