Mid
From PDF
MNC Coding
C# MNC Coding Interview
struct vs class (real-world)?
Short answer: struct vs class (real-world) What interviewers test Memory & performance awareness Use struct when: Small Immutable Value-type behavior public readonly struct Point
Example code
{
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.”
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