Learning from chatGpt


The biggest help from chatGPT has been in the form of discovering how to write what i already know, differently. 

Lets take a list of items that holds multiple components


later in the code, i have a single imageComponent and need to find a matching list item. Usually I would loop through the list with foreach and match the list item with an if statement. like this

But if i ask chatGPT to do it, i get this


I've never heard of the function FirstOrDefault. Also never had the privilege or the need to use the default return type.

Using Lambda callback as your function parameter makes it unnecessary hard to read in my opinon. But it's sure is nice to discover new ways to code. 

Leave a comment

Log in with itch.io to leave a comment.