Of all suggested I prefer second option. Generally, I prefer double dispatch over switching on Type
s.
More Related Contents:
- Is “else if” faster than “switch() case”? [duplicate]
- If vs. Switch Speed
- Make first letter of a string upper case (with maximum performance)
- Generating permutations of a set (most efficiently)
- How to pass values across the pages in ASP.net without using Session
- Is String.Contains() faster than String.IndexOf()?
- For vs. Linq – Performance vs. Future
- What is quicker, switch on string or elseif on type?
- Most efficient way to insert Rows into MySQL Database
- What is the real overhead of try/catch in C#?
- Control cannot fall through from one case label
- Why does the c# compiler emit Activator.CreateInstance when calling new in with a generic type with a new() constraint?
- File.Copy vs. Manual FileStream.Write For Copying File
- Performance of nested yield in a tree
- How can I programmatically limit my program’s CPU usage to below 70%?
- Why is Parallel.ForEach much faster then AsParallel().ForAll() even though MSDN suggests otherwise?
- Does String.GetHashCode consider the full string or only part of it?
- Huge performance difference (26x faster) when compiling for 32 and 64 bits
- In a switch vs dictionary for a value of Func, which is faster and why?
- try catch performance
- Fastest way to check if string contains only digits in C#
- Is it better to execute many sql commands with one connection, or reconnect every time?
- Is the conditional operator slow?
- Why is my C# program faster in a profiler?
- SQL Server: Dynamic where-clause
- When to use pointers in C#/.NET?
- Setting properties via object initialization or not : Any difference ?
- Winforms: SuspendLayout/ResumeLayout is not enough?
- Heap versus Stack allocation implications (.NET)
- C# Dynamic Keyword — Run-time penalty?