LINQ (Language INtegrated Query) is a set of features in C# for concise and declarative code. I use it pretty much wherever I can, but sometimes I wonder and people ask: is this a performance trap? It would be painful to have to replace many usages of LINQ with other constructs in addition to time spent finding that to be an actual bottleneck. Let’s do a basic benchmark to see what using LINQ might cost us compared to more traditional constructs such as for and foreach loops, and see if this worry is valid.

Methodology

I used the BenchmarkDotNet library. The…


Is it true that C# is just like Java? After working in Java for the last few years and coming back to C# again, there are lots of features I would be disappointed to give up. These are all things that are in the latest version of C# (8) but to my knowledge are not in the latest version of Java (14) at the time of this writing. In no particular order:

  • Tuples
  • Function types with more arguments
  • Default arguments
  • Named arguments
  • Null coalescing operators
  • Better casting
  • Extension methods
  • Properties
  • Expression-bodied function members
  • Interpolated and literal strings
  • Exception filters
  • Out…

Ask a Lisp’er why anyone of sound mind would choose such an odd programming language and they’ll likely start talking about macros. As in, Lisp has macros and your language doesn’t. Maybe you say “C has macros and they’re mostly just dangerous”, and they say “Lisp macros aren’t like that, they’re different”. So what can you do with macros in a language like Common Lisp or Clojure that you can’t do (sanely) in other programming languages? Let’s look at an example of how we might do something in Java, Python, and Clojure (a Lisp).

Aside: macros in C/C++

The example below could likely be…

James Vickers

I love functional programming and Clojure

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store