Sunday 4 November 2018

c# - Is this dependency injection?

Is this dependency injection if I change the below code



class Needer
{
Needed obj;
AnotherNeeded obj2;

public Needer()

{
obj = new Neede();
obj2 = new AnotherNeede();
}
}


To this code



class Needer

{
Needed obj;
AnotherNeeded obj2;

public Needer(Needed param1, AnotherNeeded param2)
{
obj = param1;
obj2 = param2;
}
}

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...