Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)


Footnote: When are those event guidelines applicable? When someone else will be consuming your code - especially in versioning situations. See also: What are the benefits of having events conforming to Net guidelines?What are the benefits of having events conforming to Net guidelines?.

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)


Footnote: When are those event guidelines applicable? When someone else will be consuming your code - especially in versioning situations. See also: What are the benefits of having events conforming to Net guidelines?.

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)


Footnote: When are those event guidelines applicable? When someone else will be consuming your code - especially in versioning situations. See also: What are the benefits of having events conforming to Net guidelines?.

added 356 characters in body
Source Link
Andrew Russell
  • 21.3k
  • 7
  • 57
  • 103

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)


Footnote: When are those event guidelines applicable? When someone else will be consuming your code - especially in versioning situations. See also: What are the benefits of having events conforming to Net guidelines?.

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)


Footnote: When are those event guidelines applicable? When someone else will be consuming your code - especially in versioning situations. See also: What are the benefits of having events conforming to Net guidelines?.

Source Link
Andrew Russell
  • 21.3k
  • 7
  • 57
  • 103

See this document: How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide).

Ignore it.

There is no compelling reason to follow those guidelines when you are making a game. Make your own delegate type that takes appropriate types (either existing object references or value types):

public delegate void DidSomethingHandler(MyThing what, Vector2 where);
public event DidSomethingHandler DidSomething;

Or, if you want to be especially lazy (protip: you want to be especially lazy), you can even just do this:

public event Action<MyThing, Vector2> DidSomething;

(If creating your own delegate provides better documentation or will be used in many places, do that, otherwise just use an Action.)