Mid
From PDF
MNC Coding
C# MNC Coding Interview
Dependency Injection without any framework?
Short answer: Dependency Injection without any framework What interviewers test SOLID Architecture fundamentals Step 1: Abstraction public interface IMessageService
Example code
{ void Send(string message); } Step 2: Implementation public class EmailService : IMessageService
{
public void Send(string message)
{ Console.WriteLine("Email: " + message); }
} Step 3: Injection public class Notification
{
private readonly IMessageService _service;
public Notification(IMessageService service)
{
_service = service;
}
public void Notify(string msg)
{ _service.Send(msg); }
} Why this matters Loose coupling Testable code Swappable implementations
Real-world example (ShopNest)
MNC rounds expect working code plus explanation. Walk through an example input from a ShopNest cart list, then discuss time and space.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png