c# - Initializing a class when using Generics -


I have a document class, which has two surcharges, take each parameter (string and stream). Why can not I use the following code to start a document classroom using generic?

Public Essentials PdfDocumentEditBaseService & lt; T & gt; : ID document edit service & lt; T & gt; Rotate public t (t file, int page number, float angle) {document document = new document (file); Can not be converted from 'T' to 'Stream' document. Page [page number] .Rotation = (RotationMode) angle; Document.SavePage (PAGENUMBER); Return file; }

I look at some suggestions so that the t needs to stifle the stream Ho. And that will work, but if your T is actually always a stream, then do not remove the normal parameter and why to create that square:

  Public abstract class PdfDocumentEditBaseService: IDocumentEditService {public Rotate the stream (stream file, int pnumber, float angle) {document document = new document (file); Document. Page [pejnbar] .Rotation = (RotationMode) angle; Document.SavePage (PAGENUMBER); Return file; }  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -