Is passing by reference a bad practice?

This page summarizes the projects mentioned and recommended in the original post on /r/csharp

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • FluentValidation

    A popular .NET validation library for building strongly-typed validation rules.

  • But if the logic is really complex would you not think of using something like FluentValidation rather then building your own?

  • SharpLab

    .NET language playground

  • For anyone else who is still confused, here's a quick example. You'll notice that the two functions are basically the same, both when passing in a value type and a reference, except one uses the ref keyword. While it is true that the int value that is passed into the method is a value of an integer and that the List is a reference, they have different semantics.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • referencesource

    Source from the Microsoft .NET Reference Source that represent a subset of the .NET Framework

  • https://github.com/microsoft/referencesource/blob/5697c29004a34d80acdaf5742d7e699022c64ecd/mscorlib/system/array.cs#L50

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts