Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:43:33+00:00 2026-05-31T02:43:33+00:00

Posters at Are EventArg classes needed now that we have generics and Does .NET

  • 0

Posters at Are EventArg classes needed now that we have generics and Does .NET have a built-in EventArgs<T>? are advising against a generic EventArgs, at least that’s the feeling I get.

Is it justified to use it when all I need is one of the build-in types? In my specific case I’m reading from a stream over TCP, and when data is received, subscribers are notified.

public event EventHandler<EventArgs<string>> data_received = delegate { };

...

while (!reader.EndOfStream)
{
    if ((data = reader.ReadLine()) != "")
    {
        this.data_received(this, new EventArgs<string>(data));
    }
}

Or perhaps an event isn’t the best way to pass data to subscribers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:43:34+00:00Added an answer on May 31, 2026 at 2:43 am

    Short answer: it depends.

    You can consider EventArgs<T> class like Tuple<T> for passing and returing data to/from the method. In some simple cases and for internal usage Tuple<T> is appropriate but for more complex cases or for public surface it would be more appropriate to use separate type.

    With EventArgs<T> we have more or less the same dilema. For internal usage its OK to use this type, but for public API it could lead to maintainance nightmare.

    In your particular case it seems OK to use EventArgs<T> at the first glance, but what if later you’ll decide to add some additional information to this even like EndPoint? In this case you can use EventArgs<T, U> (like Tuple<T, U>) or you can switch to custom EventArgs class. In both case you’ll break all your clients and if you only one client of this code – its ok, but if not…

    Bottom line, for internal stuff its ok to use EventArgs, but for public surface I suggest to use custom event args.

    P.S. General naming convention for events is CamelCase, and in your particular case it means that DataReceived is more appropriate name for your event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Other posters have previously said in this forum that when your Django app starts
I have table 'posters', table 'reviews' and table 'trailers'. Every table is connected with
We have urls: http://site.com/movies/posters/ID.html http://site.com/movies/posters/fixed/ID.html How do I know if /posters/fixed/ is present in
We have a poster store. Posters come in varying sizes and have optional frames.
I just wanted that when this is inserted in the URL: http://website.com/pelicula/0221889/ http://website.com/pelicula/0221889/posters/ It
I have a site in ASP.NET and i thought it would be cool if
UPDATE : thanks to posters below, it's clear that the official documentation is up-to-date.
I have multiple logos of various companies in various formats that needs to be
In my app i have a button that when click loads a new image
I've noticed that old color movies have a certain look about them, a certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.