Click here to Skip to main content
15,889,527 members
Home / Discussions / C#
   

C#

 
GeneralRe: C++ DLL within C# application Pin
my Nick2-Mar-16 11:01
my Nick2-Mar-16 11:01 
GeneralRe: C++ DLL within C# application Pin
John Torjo2-Mar-16 11:37
professionalJohn Torjo2-Mar-16 11:37 
GeneralRe: C++ DLL within C# application Pin
Mycroft Holmes2-Mar-16 11:57
professionalMycroft Holmes2-Mar-16 11:57 
AnswerRe: C++ DLL within C# application Pin
my Nick2-Mar-16 22:28
my Nick2-Mar-16 22:28 
GeneralRe: C++ DLL within C# application Pin
Richard MacCutchan2-Mar-16 22:48
mveRichard MacCutchan2-Mar-16 22:48 
AnswerRe: C++ DLL within C# application Pin
John Torjo2-Mar-16 22:52
professionalJohn Torjo2-Mar-16 22:52 
GeneralRe: C++ DLL within C# application Pin
my Nick2-Mar-16 23:07
my Nick2-Mar-16 23:07 
QuestionHow To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Foothill2-Mar-16 8:46
professionalFoothill2-Mar-16 8:46 
To explain what I am trying to do, I want to create a generic abstract base that inherits from another generic class that also needs to implement IDisposable.

Kind of like this.
C#
// This isn't giving syntax errors but doesn't work for my purposes either
public abstract class ObjectCollection<T> : Dictionary<int,T> where T : ISomeInterface, IDisposable
{
  private DataTable _sourceData;  // this is what I need IDisposable for

  public abstract LoadData(SqlCommand sourceData); // Derived classes will load data into table and base dictionary at the same time.
  
  // Class implementation...

  public void Dispose()
  {
    _sourceData?.Dispose();
  }
}

This isn't working for me as the compiler is interpreting IDisposable as another generic constraint on T. Which gets passed onto the T data type when implemented in a derived class (which doesn't qualify for Disposal). I would like the base class to implement IDisposable. Is that possible or do I need to encase the Dictionary<t> within the base class and provide this[int] indexers?
I tried ISomeInterface : IDisposable but that won't compile.
if (Object.DividedByZero == true) { Universe.Implode(); }

AnswerRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Sascha Lefèvre2-Mar-16 9:14
professionalSascha Lefèvre2-Mar-16 9:14 
GeneralRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Foothill2-Mar-16 9:22
professionalFoothill2-Mar-16 9:22 
GeneralRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Sascha Lefèvre2-Mar-16 9:33
professionalSascha Lefèvre2-Mar-16 9:33 
QuestionHow to preview office file in windows app 8.1 using C# Pin
Shaimaa Fawzy2-Mar-16 4:16
Shaimaa Fawzy2-Mar-16 4:16 
AnswerRe: How to preview office file in windows app 8.1 using C# Pin
Frank Kerrigan4-Mar-16 3:52
Frank Kerrigan4-Mar-16 3:52 
GeneralRe: How to preview office file in windows app 8.1 using C# Pin
Shaimaa Fawzy5-Mar-16 5:53
Shaimaa Fawzy5-Mar-16 5:53 
QuestionObserver Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 0:54
Bernhard Hiller2-Mar-16 0:54 
QuestionRe: Observer Pattern with Remote Machines Pin
dan!sh 2-Mar-16 1:42
professional dan!sh 2-Mar-16 1:42 
AnswerRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 2:58
Bernhard Hiller2-Mar-16 2:58 
GeneralRe: Observer Pattern with Remote Machines Pin
Sascha Lefèvre2-Mar-16 3:39
professionalSascha Lefèvre2-Mar-16 3:39 
GeneralRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 20:54
Bernhard Hiller2-Mar-16 20:54 
GeneralRe: Observer Pattern with Remote Machines Pin
dan!sh 2-Mar-16 23:00
professional dan!sh 2-Mar-16 23:00 
AnswerRe: Observer Pattern with Remote Machines Pin
Pete O'Hanlon2-Mar-16 5:52
mvePete O'Hanlon2-Mar-16 5:52 
GeneralRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 20:58
Bernhard Hiller2-Mar-16 20:58 
GeneralRe: Observer Pattern with Remote Machines Pin
Pete O'Hanlon2-Mar-16 21:08
mvePete O'Hanlon2-Mar-16 21:08 
AnswerRe: Observer Pattern with Remote Machines Pin
BillWoodruff2-Mar-16 6:43
professionalBillWoodruff2-Mar-16 6:43 
GeneralRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 21:24
Bernhard Hiller2-Mar-16 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.