Git Product home page Git Product logo

Comments (3)

egil avatar egil commented on July 30, 2024

I almost assume the compiler is smart enough to simply replace all "" with string.Empty at compile time.
A quick test in sharplab seems to indicate different LI is generated by the compiler, but the JIT produced assembler code is indeed the same. So it might be that there is a very so slight overhead during runtime for the JIT to do it's work.

That said, I do agree that this is not a readability concern, and more often than not I actually write "" in tests because it makes it easier to understand what is going on.

from atc-coding-rules.

perkops avatar perkops commented on July 30, 2024

Pr. meeting 05/02-2020, we agreed upon that we want this rule enabled for src/props and set to none for test/props.

Arguments:

  • It explicitly clarifies our intent
  • Its easier to spot string.Empty than ""
  • Its easier to search for string.Empty than a literal
  • Eliminates zero width space issues LINK
  • Minor performance gain

from atc-coding-rules.

davidkallesen avatar davidkallesen commented on July 30, 2024

https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md

from atc-coding-rules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.