5 ms·
C# is fundamentally OO (especially considering the .NET framework that it's tightly bound to in real-world use), but can be used in functional ways. C# has fir
by T-hawk 14y ago
C# is fundamentally OO (especially considering the .NET framework that it's tightly bound to in real-world use), but can be used in functional ways. C# has first-class functions and closures. The LINQ stuff introduced in 3.5 is amazing to work with, giving C# many capabilities of a list-processing language also. I love C# and would definitely call it multiparadigm.
- h_r 14y agoC# has closures but why do you say it has first class functions? I'm pretty new to C# but I thought all functions still must be members of a class. Yes you can pass delegates to, or return them from, a function but they cannot stand alone. Isn't that true?
- beagle3 14y ago> but can be used in functional ways. Every language can be used in functional ways, including Fortran, Cobol and assembly language. I think the main question is "what is idiomatic in that language?" and in that case, C#, even with LINQ, is still not functional (in the sense that Erlang, Haskell, OCaml and Scheme surely are, and Python sometimes is). For example, when you use select in c# over a user-defined collection, the enumerator might modify global state. It would be bad practice, but it's not unheard of. I wouldn't say c# is functional.