Click here to Skip to main content
15,885,059 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: FXCop (VS 2013 Pro) and private P/Invoke methods Pin
Eddy Vluggen26-Mar-14 8:10
professionalEddy Vluggen26-Mar-14 8:10 
GeneralRe: FXCop (VS 2013 Pro) and private P/Invoke methods Pin
obermd26-Mar-14 8:56
obermd26-Mar-14 8:56 
GeneralRe: FXCop (VS 2013 Pro) and private P/Invoke methods Pin
obermd26-Mar-14 13:31
obermd26-Mar-14 13:31 
QuestionError on System.Web.Helpers.WebMail.Send() method in TFS 2012 Pin
trevor1519-Mar-14 4:04
trevor1519-Mar-14 4:04 
AnswerRe: Error on System.Web.Helpers.WebMail.Send() method in TFS 2012 Pin
Richard MacCutchan19-Mar-14 4:19
mveRichard MacCutchan19-Mar-14 4:19 
QuestionGetting "Handle" of DirectX Output inside a WPF Window/Containter... Pin
Christopher Koeber18-Mar-14 11:29
Christopher Koeber18-Mar-14 11:29 
QuestionIOCContainer nested dependencies and failed resolves Pin
preaa10-Mar-14 23:38
preaa10-Mar-14 23:38 
AnswerRe: IOCContainer nested dependencies and failed resolves Pin
Pete O'Hanlon11-Mar-14 12:05
mvePete O'Hanlon11-Mar-14 12:05 
I see some things in your code which I would change, and this should hopefully clear things up for you. Basically, you're mixing up IoC with newing stuff. If I were you, I would change the implementations to something like this:
C#
public interface IBar
{
  void DoSomethingInteresting();
}

public class Bar : IBar
{
  private IDependency dependency;
  public Bar(IDependency dependency)
  {
    if (dependency == null) throw new ArgumentNullException("dependency");
    this.dependency = dependency;
  }

  public void DoSomethingInteresting() {}
}

public class Foo
{
  private IDependency dependency;
  private IBar bar;
  public Foo(IDependency dependency, IBar bar)
  {
    if (dependency == null) throw new ArgumentNullException("dependency");
    if (bar == null) throw new ArgumentNullException("bar");
    this.dependency = dependency;
    this.bar = bar;
  }

  public void DoSomething()
  {
    bar.DoSomethingInteresting();
  }
}
As you can see, we're relying on injecting any dependencies here (i.e. injecting IBar rather than newing up Bar), and we test in the constructor for nulls. That way, we determine early on whether or not an actual implementation has been passed in.
GeneralRe: IOCContainer nested dependencies and failed resolves Pin
preaa11-Mar-14 21:38
preaa11-Mar-14 21:38 
GeneralRe: IOCContainer nested dependencies and failed resolves Pin
Pete O'Hanlon11-Mar-14 21:50
mvePete O'Hanlon11-Mar-14 21:50 
QuestionCréation d'un outil intelligent pour la vidéosurveillance" with vb.net 2008 Pin
Sahal Meriem10-Mar-14 9:32
Sahal Meriem10-Mar-14 9:32 
AnswerRe: Création d'un outil intelligent pour la vidéosurveillance" with vb.net 2008 Pin
Dave Kreskowiak10-Mar-14 10:11
mveDave Kreskowiak10-Mar-14 10:11 
QuestionError: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
Member 105062157-Mar-14 3:12
Member 105062157-Mar-14 3:12 
AnswerRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
Richard MacCutchan7-Mar-14 7:25
mveRichard MacCutchan7-Mar-14 7:25 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
Member 1050621510-Mar-14 4:30
Member 1050621510-Mar-14 4:30 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
melquimoises10-Mar-14 12:15
melquimoises10-Mar-14 12:15 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
melquimoises28-Mar-14 6:46
melquimoises28-Mar-14 6:46 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
melquimoises28-Mar-14 6:46
melquimoises28-Mar-14 6:46 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
melquimoises28-Mar-14 6:47
melquimoises28-Mar-14 6:47 
AnswerRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
knocky20108-Mar-14 22:14
knocky20108-Mar-14 22:14 
AnswerRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
Richard Deeming10-Mar-14 2:11
mveRichard Deeming10-Mar-14 2:11 
GeneralRe: Error: Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible' Pin
Member 1050621510-Mar-14 4:35
Member 1050621510-Mar-14 4:35 
Questionhow to get connection strings in web api 4.0 from app.config file Pin
rincy sivan7-Mar-14 0:05
rincy sivan7-Mar-14 0:05 
AnswerRe: how to get connection strings in web api 4.0 from app.config file Pin
Richard MacCutchan7-Mar-14 0:12
mveRichard MacCutchan7-Mar-14 0:12 
QuestionFile names Pin
byka4-Mar-14 7:03
byka4-Mar-14 7:03 

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.