Mid From PDF MNC Coding C# MNC Coding Interview

struct vs class (real-world)?

struct vs class (real-world)

What interviewers test

  • Memory & performance awareness

Use struct when:

  • Small
  • Immutable
  • Value-type behavior
public readonly struct Point
{
public int X { get; }
public int Y { get; }
}

Use class when:

  • Large
  • Mutable
  • Shared references
public class User
{
public string Name { get; set; }
}
Interview statement

“Structs live on stack or inline, classes live on heap with GC cost.”

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