The Artima Developer Community
Sponsored Link

.NET Buzz Forum
More Tricks w/ C# Generics

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
More Tricks w/ C# Generics Posted: Aug 12, 2003 2:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: More Tricks w/ C# Generics
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

Christian Nagel shows us another neat trick we can expect out of C# generics:

The declaration

public delegate void EventHander<S, T>(S sender, T args) where T : EventArgs;

also shows a big difference to the template implementation of C++. With C# generics it is possible to define requirements of generic types, such as T needs to be of type of EventArgs (or derived from this class). With C++ templates we just find out that a type doesn't fulfill the requirements when compiling the template using the specific type. Often the compiler error messages with many, many lines are not easy to read.

Very nice. I was an STL junkie I remember all the nasty errors produced by the compiler when you did something wrong. I really like the way that reads too.

Read: More Tricks w/ C# Generics

Topic: COM Interop and .NET Previous Topic   Next Topic Topic: The daVinci Diagram Surface Could Not Be Found - A Lesson in Stress Management

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use