Delegate types in C#: Action
vs Func
vs Predicate
Published on in C#
Last updated on
Action
doesn't return anything,
Func
does.
Predicate
takes one parameter and returns a boolean.
Action
vs Func
vs Predicate
Published on in C#
Last updated on
Action
doesn't return anything,
Func
does.
Predicate
takes one parameter and returns a boolean.
The NSubstitute package simplifies how mock implementations are created and how mocks are used.
The Fluent Assertions package makes unit test assertions read like English and also improves the error messages.
Disabling the upscaling feature (by default or completely)
can be done via ImageProcessor's ValidatingRequest
event.
It's not possible via a config file.
YouTube recommended me a two-part video series that was fun to watch and gave me a few lightbulb thoughts.
as
and is
operatorsA cast expression like (string)foo
throws
if the types don't match.
The as
operator doesn't throw
and defaults to null
.
The is
operator doesn't throw
and ignores null
s.
Blocks in Episerver implement the IContent
interface only during runtime
which makes using AutoMapper difficult.
Published on in C#, Episerver and JavaScript
Requests with the Accept
header set to application/json
are automatically routed to Content Delivery API.
Here's how to bypass it
and make the request go to a page controller instead.
When migrating content from another platform to Episerver,
I wanted to set a specific datetime for each content's Modified date (Saved
property).
Sounds simple,
but it was only possible by using Episerver's internal, undocumented API.
default
doesn't have to be the last casePublished on in C#, Clean code, JavaScript and TypeScript
Last updated on
Non-last default
cases are confusing
but perfectly valid.
Sometimes it makes sense to place them at the beginning or in the middle.