1️⃣ What is code optimization in .NET, and why is it important? ➡️ It’s about making code run faster, use less memory, and reduce bugs—leading to efficient and maintainable projects. 2️⃣ How do you find performance bottlenecks in .NET apps? ➡️ Use tools like Visual Studio Profiler, JetBrains dotTrace, or Application Insights to spot slow code and fix it early! 3️⃣ Best data structures for fast data retrieval in .NET? ➡️ Prefer Dictionary for lookups, List for indexed access, and ConcurrentDictionary for thread-safe scenarios. 4️⃣ Why limit excessive logging in production code? ➡️ Too much logging = slower app + increased costs. Log only what’s essential! 5️⃣ How does async programming (async/await) boost performance? ➡️ Keeps your app responsive by handling multiple tasks without blocking threads. 6️⃣ Steps to reduce unnecessary memory allocations? ➡️ Use structs, re-use objects (object pooling), and avoid big objects unless truly needed. 7️⃣ H...
1. Reverse a String Without Built-in Methods Q: Write a C# method to reverse a string without using built-in reverse functions. A: string Reverse(string input) { char[] result = new char[input.Length]; for (int i = 0; i < input.Length; i++) result[i] = input[input.Length - 1 - i]; return new string(result); } 2. Find Duplicates in an Integer Array Q: Detect and print duplicates in an integer array. A: void FindDuplicates(int[] arr) { var seen = new HashSet<int>(); foreach (int num in arr) { if (seen.Contains(num)) Console.WriteLine("Duplicate: " + num); else seen.Add(num); ...