C# contructor in interface
I know that we can't have constructor in an interface but here is what I want to do :


         interface ISomething 
         {
               void FillWithDataRow(DataRow)
         }
         

         class FooClass<T> where T : ISomething , new()
         {
              void BarMethod(DataRow row)
              {
                   T t = new T()
                   t.FillWithDataRow(row);
              }
          }
           

It would be better replacing the method FillWithDataRow in ISomething definition by a contructor.

Indeed, now my member class can be readonly (they can't with the current method).

Anyone has some patterns in order to do what I want ?





           


         
         

        
     


C# contructor in interface
===

I know that we can't have constructor in an interface but here is what I want to do :


         interface ISomething 
         {
               void FillWithDataRow(DataRow)
         }
         

         class FooClass<T> where T : ISomething , new()
         {
              void BarMethod(DataRow row)
              {
                   T t = new T()
                   t.FillWithDataRow(row);
              }
          }
           

It would be better replacing the method FillWithDataRow in ISomething definition by a contructor.

Indeed, now my member class can be readonly (they can't with the current method).

Anyone has some patterns in order to do what I want ?





           


         
         

        
     

