Unrecognized syntax in domain object constructor
Can anyone help me determine what is the purpose of this unrecognized syntax. It's a little overkill in the constructor for this object. I'm trying to figure out what is the "<IdT>" at the end of a class declaration line? I think this is what I find useful, I just need to understand why exactly so many people are doing this.
using BasicSample.Core.Utils;
namespace BasicSample.Core.Domain
{
/// <summary>
/// For a discussion of this object, see
/// http://devlicio.us/blogs/billy_mccafferty/archive/2007/04/25/using-equals-gethashcode-effectively.aspx
/// </summary>
public abstract class DomainObject<IdT>
{
/// <summary>
/// ID may be of type string, int, custom type, etc.
/// Setter is protected to allow unit tests to set this property via reflection and to allow
/// domain objects more flexibility in setting this for those objects with assigned IDs.
/// </summary>
public IdT ID {
get { return id; }
protected set { id = value; }
}
0
source to share
4 answers
right I know a little about what generics are, used lists, delegates, etc. What I don't understand, I think, is what the effect is putting "<dataType>" after the class declaration, and why you would do that. If I were to declare this object, I would do the following:
Public class DomainObject {Public DomainObject (int ID) {this.ID = ID; } ....
0
source to share