Thursday, February 27, 2025

C# differences


# Concept Comparison Example
1 Abstract Class vs Interface Abstract class can have implementations; interface cannot. abstract class A {} vs interface I {}
2 Ref vs Out ref requires initialization, out does not. void Method(ref int x) vs void Method(out int x)
3 Value Type vs Reference Type Value types store data directly; reference types store memory addresses. int x = 5; vs string s = "Hello";
4 == vs Equals() == checks reference for objects, Equals() checks values. "abc" == "abc" vs "abc".Equals("abc")
5 Sealed vs Static vs Abstract Class sealed prevents inheritance, static prevents instantiation, abstract enforces method overriding. sealed class A {}, static class B {}, abstract class C {}
6 Method Overloading vs Overriding Overloading is same method with different parameters; Overriding modifies base method. void Show(int x) vs override void Show()
7 Stack vs Queue Stack: LIFO, Queue: FIFO. Stack<int> stack = new Stack<int>();
8 Stack vs Heap Stack stores value types; Heap stores reference types. int x = 10; (Stack) vs new Person(); (Heap)
9 IEnumerable vs IQueryable IEnumerable executes in-memory, IQueryable executes on the database server. IEnumerable<T> (Linq in-memory) vs IQueryable<T> (Linq-to-SQL)
10 String vs StringBuilder string is immutable, StringBuilder is mutable. string s = "Hello"; vs StringBuilder sb = new();
11 Task vs Thread Task is for async programming, Thread is for parallel execution. Task.Run(() => {...}) vs new Thread(()=> {...}).Start();
12 ReadOnly vs Const vs Static const is compile-time, readonly is runtime, static belongs to class. readonly int a;, const int b = 10;, static int c;
13 Dispose vs Finalize Dispose() is called explicitly; Finalize() is called by GC. using(obj) {...} vs ~ClassName()
14 Early Binding vs Late Binding Early binding is compile-time; Late binding is runtime. var obj = new Class(); (early) vs dynamic obj = new Class(); (late)
15 XML vs JSON XML uses tags, JSON uses key-value pairs. <Person><Name>John</Name></Person> vs {"Name": "John"}
16 Static Constructor vs Instance Constructor Static runs once per class; instance runs per object. static Example() {} vs public Example() {}
17 DataSet vs DataReader DataSet stores data in memory; DataReader reads forward-only. DataSet ds = new DataSet(); vs SqlDataReader dr = cmd.ExecuteReader();
18 Hashtable vs Dictionary Dictionary<T, T> is type-safe; Hashtable is not. Dictionary<int, string> d = new();
19 Struct vs Class struct is value type; class is reference type. struct Point {} vs class Point {}
20 Interface vs Delegate Interface defines behavior; Delegate is a method reference. interface IRun {} vs delegate void MyDelegate();
21 IS vs AS Operator is checks type compatibility; as performs safe casting. if (obj is string) vs string s = obj as string;
22 Singleton vs Static Class Singleton allows only one instance; Static class cannot be instantiated. private static Singleton instance; vs static class MyClass {}
23 Lazy Loading vs Eager Loading Lazy loads data when needed; Eager loads immediately. Lazy<T> obj = new Lazy<T>();
24 Throw vs Throw ex throw preserves stack trace, throw ex resets it. throw; vs throw ex;
25 Partial Class vs Abstract Class Partial splits a class, Abstract enforces overriding. partial class MyClass {} vs abstract class MyClass {}
26 Deep Copy vs Shallow Copy Deep Copy creates a new object, Shallow Copy copies reference. Clone() for Deep, MemberwiseClone() for Shallow
27 Boxing vs Unboxing Boxing converts value type to object, Unboxing retrieves value type from object. object obj = 10; (Boxing) vs int x = (int)obj; (Unboxing)
28 Implicit vs Explicit Conversion Implicit is automatic; Explicit requires casting. int x = 10; double d = x; vs double d = 10.5; int x = (int)d;
29 Delegate vs Event Delegate is a function pointer, Event is a restricted delegate. delegate void MyDelegate(); vs event MyDelegate MyEvent;
30 Thread vs Process Thread is lightweight; Process is heavyweight. Thread t = new Thread(); vs Process p = new Process();


Wednesday, February 12, 2025

Process with an Id of '###' is not running" in Visual Studio || process with an id of '123' is not running

If an error occurs, right-click on the project and unload it. Then, right-click again and choose 'Edit'. After

 that, search for 'DevelopmentServerPort'. You will find the following lines

<DevelopmentServerPort>62343</DevelopmentServerPort>

<DevelopmentServerVPath>/</DevelopmentServerVPath>

<IISUrl>http://localhost:62878/</IISUrl>

Remove these lines, then reload the project. After that, run the project, and it will work.

Friday, January 3, 2025

VISA Thumb and Interview Process : This is what I experienced. I failed the interview today. Feeling very sad :(

 VISA Thumb and Interview Process:

Thumb Day:
On the DS-160 form, there is a "Completed On" date. This date must be within one year before the interview date.

For example, if you are attending the interview on January 2, 2024, the "Completed On" date should not be earlier than January 2, 2023. If it's incorrect, log in to the portal, update the date, and print the corrected form. Carry this updated printout with you. Otherwise, they might send you back, asking you to correct the date and return.

Today's required documents: Passport, DS-160 form, and appointment confirmation letter. These two printouts along with the original passport. You must attend with your thumb ready.

Interview Day:
Whatever information you entered in the DS-160 form will be asked during the interview. You must answer accurately and exactly as you filled in the form.

For example, if it’s about your date of birth, ensure you provide the exact details as mentioned in the form. Don’t provide more or less information than what’s in the form.

Today's required documents: Passport, DS-160 form, and appointment confirmation letter. These two printouts along with the original passport. If attending for B1, invitation letters are also needed. Additionally, original certificates, Xerox copies, salary-related payslips, and any other necessary documents would be better to carry.

I attended for B1. If someone else is inviting, they ask for a copy of their visa or passport. I heard them mentioning this there.

If you are going for this process, follow these steps. All the best!