concept side effect in category c#

This is an excerpt from Manning's book C# in Depth, Fourth Edition.
There are two more important aspects to note when it comes to evaluating method calls. First, arguments are evaluated in the order they appear in the source code for the method call, left to right. In most cases, this wouldn’t matter, but if argument evaluation has side effects, it can. As an example, consider these two calls to our sample method:
This listing is in many ways just a variation of listing 10.14, in which we used logging to investigate the semantics of the two-pass exception system. In this case, you’re never catching the exception in the filter; the whole try/catch and filter exist only for the side effect of logging.

This is an excerpt from Manning's book Functional Programming in C#: How to write better C# code.
Elm (http://elm-lang.org/) is a strongly typed, purely functional client-side language that compiles to JavaScript. The syntax is terse, similar to Haskell or F#, but the language and tooling are much more user-friendly. It includes a framework that takes care of managing state and performing side effects. As a result, the programmer only writes pure functions. Simply put, Elm puts any existing JavaScript framework to shame. If you’re a full-stack web developer, consider using Elm for the front end.
Table 2.1. Requirements of pure functions
Pure functions
Impure functions
The output depends entirely on the input arguments. Factors other than input arguments may affect the output. Cause no side effects. May cause side effects. To clarify this definition, we must define exactly what a side effect is. A function is said to have side effects if it does any of the following:
Ok, let’s aim to use pure functions whenever possible. But is it always possible? Is it ever possible? Well, if you look at the list of things considered side effects, it’s a pretty mixed bag, so the strategies for managing side effects depend on the types of side effects in question.
Another kind of side effect is the mutation of function arguments. Mutating function arguments is a bad idea in any programming paradigm, but I’ve repeatedly stumbled on implementations that do something like this:
decimal RecomputeTotal(Order order, List<OrderLine> linesToDelete) { var result = 0m; foreach (var line in order.OrderLines) if (line.Quantity == 0) linesToDelete.Add(line); else result += line.Product.Price * line.Quantity; return result; }

This is an excerpt from Manning's book Real-World Functional Programming with Examples in F# and C#.
The code declares two top-level values. The first is an instance of a .NET class Random, which is used for generating random numbers. The second is a function randomBrush. It has a unit type as a parameter, which is an F# way of saying that it doesn’t take any meaningful arguments. Thanks to this parameter, we’re declaring a function that can be run several times giving a different result. If we omitted it, we’d create a value that would be evaluated only once when the application starts. The only possible unit value is (), so when calling the function later in the code, we’re actually giving it unit as an argument, even though it looks like a function call with no arguments at all. The randomBrush function uses the rnd value and generates SolidBrush object, which can be used for filling of specified regions. It has side effects and as you already know, we should be careful when using side effects in functional programs.
Hiding the side effects
The function randomBrush is an example of a function with side effects. This means that the function may return a different result every time it’s called, because it relies on some changing value, other than the function arguments. In this example, the changing value is the value rnd, which represents a random number generator and changes its internal state after each call to the Next method. Listing 4.7 declares rnd as a global value despite the fact that it’s used only in the function randomBrush. Of course, this is a hint that we should declare it locally to minimize the number of global values. We could try rewriting the code as follows:
We’ll also examine a topic that’s closely related to refactoring. When a program lacks side effects, we should get the same result regardless of the order in which the individual parts are executed. A value can be calculated as soon as it’s declared, or we can delay execution until the value is really needed. This technique is called laziness (or lazy evaluation), and we’ll show you some of the practical benefits when we explore potentially infinite data structures and caching of computer values.
We can’t modify a collection when we’re working with immutable data structures, so the method first creates a new collection that contains only multiword names ❶. We’ve also made the side effect from the previous implementation explicit, so the method now returns the new collection. Of course, it isn’t really a side effect at all now—it’s a return value. It achieves the same result of making the multiword names list available to the caller if they want it ❷.