Mid From PDF MNC Coding C# MNC Coding Interview

Handle millions of records efficiently?

Handle millions of records efficiently

What interviewers test

  • Memory pressure awareness
  • Streaming & batching

❌ Bad (Loads everything)

var users = db.Users.ToList(); // Memory explosion

✅ Streaming (Best)

await foreach (var user in db.Users.AsAsyncEnumerable())
{

Process(user);

}

✅ Batching

const int batchSize = 1000;
for (int i = 0; i < total; i += batchSize)
{
var batch = GetBatch(i, batchSize);

ProcessBatch(batch);

}

Key principles

  • Never load everything
  • Prefer streams
  • Control memory explicitly

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details