Generic casting question C# -


I have a function that takes general:

  public static ShowTrackChangesViewModel CreateVM & Lt; T & gt; (IILIT & Lt; Track Changes & gt; Track Changes, Tee Entity) {// How do I use T properties? }  

T here is a unit framework object. How do I put it back to real one to use my property? Do I have to write a big code? Thx

You can add this little gem to say that T Type of object MyBaseType :

  Public Static ShowTrackChangesViewModel CreateVM & lt; T & gt; (IList & lt; TrackChanges & gt; Track Changes, Tea Organizations) where T: MyBaseType  

Then, you can use the unit as if it was a MyBaseType was if you need specific qualities that are not in the base category, then you do not want a general method (because it will not be normal!).

Hope that helps!


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -