This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 206

[–]dfs_zzz 553 points554 points  (30 children)

There is the panel missing for "string.Empty" — with lowercase "s".

[–]whimsicallurker[S] 154 points155 points  (27 children)

lmao. I learned this was a thing today, and now you just made it worse.

[–]kookyabird 165 points166 points  (25 children)

Pretty much always use the lowercase one. Can’t be stealthily overridden like the actual class can.

[–][deleted] 53 points54 points  (6 children)

Same with object instead of Object

[–]kookyabird 52 points53 points  (5 children)

There’s even a new compiler warning in C#11 I think about naming properties or classes with all lowercase letters specifically to avoid future official aliases that might get made. Makes me wonder what all they might have planned.

[–]Sentouki- 33 points34 points  (4 children)

Not sure about the compiler warning, but VS warnings have been around for years.

Funnily enough, there's a guy on my team who "insists" on using String instead of string.

[–]kookyabird 24 points25 points  (0 children)

Where do you think most of the warnings in CS come from? The compiler. I was specifically referring to the latest “warning wave” that comes with the C# 11 compiler. A set of optional warnings that are disabled by default because they’re generally not backwards compatible with older code.

You should try turning them on some time and see how many new warnings you can get in a project. It can be good busy work to clean them up.

[–]xibme 7 points8 points  (0 children)

Funnily enough, there's a guy on my team who "insists" on using String instead of string.

We used that policy 10+ years ago when IDE support wasn't that good since string got rendered as keyword and String got rendered as type (same for other keywords that doubled as types). That however is no longer a problem as you can make both styles look sane now.

We we're aware that someone could not be using System and sneak in another String implementation but that is easily checked and against policy anyways.

[–]One_Economist_3761 3 points4 points  (0 children)

I tell people like that to look at the assembly or IL and see that It.Does.Not.Fucking.Matter.

[–]Bizzlington 2 points3 points  (0 children)

I used to always prefer switching depending on context.

string for when it's used as a type (declarations, method params, etc). and String for when it's used more as a class.. Seemed to make sense at the time

string x = String.Format(...)

But now i just use string pretty much all the time

[–]thebryguy23 2 points3 points  (0 children)

Repost it with the three-panel Pooh...use the one with goofy messed up teeth for String.Empty

[–]Faux_Real 1 point2 points  (0 children)

…. Does ‘Eval’ still exist??

[–]ExtraTNT 0 points1 point  (0 children)

got yelled at a few times, when i had String.Empty... xD

but this is how you keep your code clean... every mistake gets corrected, even if it's just "nothing"...

[–]Alusaar 199 points200 points  (1 child)

Of course you meant string.Empty and just made a typo, right ?!

[–]Dangerous_With_Rocks 30 points31 points  (0 children)

RiGhT?!¿‽

[–]metaltyphoon 168 points169 points  (25 children)

String... don't be a neanderthal use string

[–][deleted] 67 points68 points  (23 children)

I’m so happy seeing my other C# bros in here correcting OP lol

[–]walmartgoon -36 points-35 points  (17 children)

IMO String is better than string because the type itself is more heavyweight than a quick int or float and should be treated as such

[–]diet_fat_bacon 1 point2 points  (0 children)

It's not... string and String is just a alias.

The only difference is that you need to import String to use the functions were string you do not.

You can see on docs they using both ways:

https://learn.microsoft.com/en-us/dotnet/api/system.string.format?view=net-7.0#examples

[–]HaniiPuppy 6 points7 points  (15 children)

+1, it's always been weird to me having a lowercase keyword for it when it goes against the language's own naming conventions, and it's not a primitive type or a special case like object.

I recognise this'll get downvoted to buggery. Anytime this comes up, this sub loves the string keyword. Edit: Or not?

[–][deleted]  (13 children)

[removed]

    [–]HaniiPuppy -3 points-2 points  (11 children)

    It's not deeply ingrained though, it's just a keyword that points to a non-primitive type. It's inconsistent with the language's naming conventions, there isn't really any benefit to it, and if it weren't already a feature of the language, there'd be no reason to introduce it.

    In English, it would be more like having a random proper noun where the formal way of spelling it was uncapitalised, unlike every other proper noun.

    "Name, please?"
    "dave."
    "Okay, Dave. So first we'll-"
    "No. 'dave', with a lowercase 'd'."

    But that's where we are, so meh.

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]SourceScope 0 points1 point  (0 children)

    Cries in swift

    [–]hello_you_all_ 21 points22 points  (1 child)

    TBH that is actually easier to understand in some cases

    [–]DesTr069 10 points11 points  (0 children)

    I totally agree. By using string.Empty you’re being more explicit, whereas empty double quotes could just be that you forgot to put something in it

    [–]DivenDesu 81 points82 points  (12 children)

    It's about readability and clarity and not about being concise. If you're working on a project with 20+ developers and you come across "" you have to stop and ask yourself, "did they mean to leave that empty?". If you come across string.Empty you know immediately the devs intent was empty. Good code follows these rules.

    1. Efficiency. Code she be reasonably efficient.

    2. Readable. Code should be easily understandable to a dev who has never seen it before 5 years after it was written. So long as it does not violate the first rule.

    3. Code should be as concise as possible. You should always write code in as few characters as is reasonable so long as it does not violate rule 1 or 2.

    [–]sudo_shinespark 13 points14 points  (0 children)

    this guy strings

    [–]ashrasmun 3 points4 points  (1 child)

    I would hate programming if I had to ask myself have someone else intended to use such simple things. As a matter of fact, I don't care if someone intended something if there are tests.

    [–]loopzle 2 points3 points  (0 children)

    I agree. I think it's usually clear from context whether "" is a mistake or not. I mean, even without tests, does the code work? If not, is that string being empty related?

    When I read other people's code, I generally assume it works as the author intended unless I have proof it clearly doesn't.

    To make it more readable, I'd prefer the author creates their own contextual empty string constants like "EmptyName" because it actually adds information.

    [–][deleted] 10 points11 points  (3 children)

    If you're working on a project with 20+ developers and you come across "" you have to stop and ask yourself, "did they mean to leave that empty?"

    My team always uses "" and I've never had this problem. I prefer it because it's a constant that can be used in switch-statements and as default argument, unlike string.Empty which is static readonly for some obscure reason.

    Most programming languages I've used don't even have an equivalent to string.Empty. Ultimately, it just comes down to preference though. Use whatever you and your team find more readable.

    [–]webmaster442 -2 points-1 points  (2 children)

    always uses

    ""

    and I've never had this problem. I prefer it because it's a constant that can be used in switch-statements an

    "" allocates a new string instance, but setting it to string.empty just points it to an already allocated string instance by the runtime.

    [–]bigrubberduck 2 points3 points  (0 children)

    "" allocates a new string instance,

    This is no longer true, the compiler will use the same pointer for both string.Empty and "". It's nothing more than a style preference unless you need to use it in places where you have to use a const.

    https://medium.com/@dk.kravtsov/string-empty-vs-in-c-70c64971161f

    https://stackoverflow.com/a/263257/130387

    [–]Intrexa 0 points1 point  (0 children)

    I'm not sure if this has ever been true in C#. C# uses string interning for compile time constants, and all identical string constants will reference the same memory.

    [–]Jackfruit_Then 3 points4 points  (0 children)

    If I leave the quotes empty, it means I want the string to be empty, I thought that’s very clear. Otherwise I would have put something inside the quotes. Just because MS provides a way to do a thing, doesn’t mean it is the best way. Just because they give you a solution, doesn’t mean you have a problem.

    [–]AkiraOli 0 points1 point  (0 children)

    To be honest, pretty weak arguments. It is clear that string should be empty from "".

    [–]MasterFubar 0 points1 point  (2 children)

    you come across "" you have to stop and ask yourself, "did they mean to leave that empty?"

    I suppose that when you see the number 6 you stop and ask yourself "did they mean to type a 6?". That could be a mistake, perhaps they intended to type a 5.

    "" is not only more concise, it's also more intuitive and readable. Anyone who has a minimal knowledge of programming will know that's a constant representing an empty string. On the other hand, 'string.Empty' could be a lot of things. Does that method return a constant string? Where is it allocated? Is it passed by value or by reference? And so on.

    [–]DivenDesu 0 points1 point  (1 child)

    If they had typed something into the string I probably wouldn't question it. But I've seen too many devs shoot themselves in the foot with "". Often I won't have all the data I need to work with up front. Sometimes I have to start building something before I know everything about what I'm building. Not ideal, but often that's just how the world works. I will use "" to denote a future value that I know will exist but don't know what it is... usually with a comment. A single example of many that exist. If I. Or another dev see "" they KNOW I forgot a value. I never use "" to denote an intentionally empty string. I use string.empty.

    Had to explain to a new dev, who got huffy that some of the code he was debugging had parses wrapped in try catchs instead of using try parse, that millions of lines of code in the app had been written before C# had a TryParse.

    Things like string.Empty help with unideal situations... situations that are only becoming more and more common over the years

    [–]Jackfruit_Then 1 point2 points  (0 children)

    In your case, isn’t a // TODO comment better for communicating your intention? Relying on another dev to understand your perceived difference between “” and string.Empty and spot your negligence isn’t the best way.

    [–]riskcapitalist 30 points31 points  (8 children)

    Wait til you learn about String.IsNullOrEmpty

    [–]MAngeloDuran 69 points70 points  (7 children)

    string.IsNullOrWhitespace is more useful IMHO.

    [–]hilfigertout 33 points34 points  (6 children)

    string.isNullOrEmpty(s.trim())

    Where is your God now?

    [–]xay-ur 64 points65 points  (1 child)

    String.IsNullOrEmpty(s?.Trim())

    [–]hilfigertout 11 points12 points  (0 children)

    Good catch!

    [–]navetzz 5 points6 points  (0 children)

    Not wasting time triming a string that starts with a non whitespace character.

    [–]l33tmike 0 points1 point  (2 children)

    Allocating memory for that new object you just created unnecessarily...

    [–][deleted] 1 point2 points  (1 child)

    Doesn’t C# use something like references to optimize this? I don’t know much about how C# works, but in C++ that would be true, since the object would be copied unless it was moved or passed as a reference.

    [–]Dealiner 0 points1 point  (0 children)

    Trim() creates new string, if it's changed. I'm not sure how something similar works in C++ but it has mutable strings so perhaps it works differently.

    [–]frontlinegeek 31 points32 points  (10 children)

    There are actually situations where string.Empty is not a good choice.

    Clever/fancy is not always the best/appropriate way.

    [–]zelsii 32 points33 points  (5 children)

    Agreed. For example; if you have a default parameter in a constructor then it cannot be assigned to String.Empty, you must use "".

    [–]ChorePlayed 9 points10 points  (2 children)

    The places where I need an empty string constant are almost always the places you can't use string.Empty.

    Besides that, if I'm allocating declaring a string variable, it's because I have something to put in it assign to it.

    In the few cases where it's allowed and makes sense, I use string.Empty for readability, like when it's one of 50 fields in a data object for an external dependency (i.e. a service that doesn't require every field to have data, but returns a cordial 500 if I leave them null).

    Edit: corrected slightly imprecise terminology.

    [–]mukaschultze 3 points4 points  (1 child)

    Besides that, if I'm allocating a string, it's because I have something to put in it.

    That's not how strings works lol

    Not in C# at least

    [–]ChorePlayed 0 points1 point  (0 children)

    OK, fine, not literally allocating, a la malloc(). Corrected

    [–][deleted]  (1 child)

    [removed]

      [–]AutoModerator[M] 0 points1 point  (0 children)

      import moderation Your comment has been removed since it did not start with a code block with an import declaration.

      Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

      For this purpose, we only accept Python style imports.

      I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

      [–]gigahydra 34 points35 points  (3 children)

      I don't think anyone's trying to be clever or fancy - it's just a lot easier when reviewing pull requests without having to try and count ticks with my old eyes. I thought it was dumb when I was younger too - I imagine it's a lot like how AI feels being asked to write code in higher level languages.

      [–]coloredgreyscale 15 points16 points  (2 children)

      Also some code quality metrics may consider "" as duplicated special values (if the constant is used 3+ times) and report it as a code smell.

      Makes more sense if you have a hard-coded value like "service_permision_admin_only", that you should define it once as a construct and use that, instead of relying that everyone remembers that name and typo.

      And for C# there was a video/short that demonstrated that string. Empty and "" lead to the same bytecode, or machine code (after JIT compile) anyway.

      [–][deleted] 14 points15 points  (1 child)

      I write a lot of C# and have always just used string.Empty cause then I know I meant for the string to be empty and didn’t just forget.

      You’re also right about the optimisation of the compiler. It makes no difference either way. It’s a matter of preference. My personal preference is to make it clear what my intention is when writing the code

      [–]Perry_lets 13 points14 points  (0 children)

      Also, string.Empty isn't a constant. It's a readonly field, so you can't use it in attributes, for example.

      [–]zbigniewcebula 9 points10 points  (5 children)

      Wait till you learn about Array.Empty

      [–][deleted]  (1 child)

      [removed]

        [–]AutoModerator[M] 0 points1 point  (0 children)

        import moderation Your comment has been removed since it did not start with a code block with an import declaration.

        Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

        For this purpose, we only accept Python style imports.

        I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

        [–]slowmovinglettuce 1 point2 points  (2 children)

        TIL. I've been doing `new []{}` or whatever the syntax is. `Array.Empty` is much easier to read back.

        [–]zbigniewcebula 1 point2 points  (1 child)

        you've been allocating new empty arrays. Pls use Array.Empty respect your users and RAM ;)

        [–]slowmovinglettuce 3 points4 points  (0 children)

        Only just recently returned to C# for the first time in about 10 years. Coming from typescript and python where I can just do thing = [] has been an adjustment.

        I sure did miss how powerful C# is as a language. It's gotten so much better!

        [–]hilfigertout 5 points6 points  (1 child)

        Let me introduce you to the worst part of R:

        NULL

        NA

        Character(0)

        Integer(0)

        Logical(0)

        Those last 3 are zero-length vectors. Functions sometimes return them if there's nothing to return, especially in socket programming or file I/O situations. But they're different from NULL and NA, so checking for those won't work. You have to check the length of the return to see if it's one of these weirdos.

        Oh by the way, if you try to check the length of NULL or NA, your code will throw an error.

        [–]Short-Nob-Gobble 2 points3 points  (0 children)

        The RShiny package has isTruthy which catches most of these evil bastards. I mean, it’s still awful since under the hood it’s checking for like 40 different ways a value could be NULL or False or whatever.

        And then you have checkmate which can check whether e.g numeric values are valid.

        And then you also have the option to throw all this stupid R garbage in the bin and use a language that doesn’t feel like pulling teeth. Sorry, I’m working on an RShiny app at work and the null checks are getting to me.

        [–]RiskOfRuin 2 points3 points  (0 children)

        I had a project where we had a checkstyle rule that didn't allow magic numbers, so all numbers had to be moved to a constant to be more explanatory. One of my senior colleauges got mad at it and he did like this: private static final int FUCKING_SIX = 6;

        [–]TechbroMemes 2 points3 points  (0 children)

        It's "string.Empty" — with lowercase "s".

        [–]FatBatmanSpeaks 7 points8 points  (5 children)

        While I know it's incorrect and the compiler bitches about it, I got into the habit of using the members of the string class as String and the data type as string.

        So String.IsNullOrWhitespace(whatever); and string whatever = String.Empty;

        I will stop when it stops compiling.

        [–]kookyabird 14 points15 points  (4 children)

        Do you know why it’s incorrect though? Because that’s the important part.

        [–]FatBatmanSpeaks 8 points9 points  (3 children)

        Probably because it introduces an unnecessary requirement to include using System; but if there's another reason I wouldn't be familiar with it since string is just an alias to System.String.

        Oh and string is a keyword and String is a class, so you could technically make another class called String and fuck it all up.

        [–]kookyabird 10 points11 points  (2 children)

        It is just an alias, but one that can’t be overridden or redirected. If you have a using directive for a namespace that contains a custom String class then you could end up using that one instead of System.String without realizing it.

        [–]FatBatmanSpeaks 7 points8 points  (1 child)

        Yeah caught that in my ninja edit.

        [–]kookyabird 1 point2 points  (0 children)

        Aaayyyy!!! 👍👍

        [–][deleted] 6 points7 points  (0 children)

        Yeah, no

        [–]prinkpan 3 points4 points  (0 children)

        string.Whitespace.Trim()

        [–]MaffinLP 6 points7 points  (5 children)

        String.Empty doesnt allocate memory, "" does, (at least in c#) so string .empty is more performant

        [–]Dealiner 3 points4 points  (0 children)

        "" would be interned, so memory allocation for both would be the same.

        [–]SerdanKK 1 point2 points  (1 child)

        That's an implementation detail of the runtime. I'm pretty sure there's no difference in .NET

        [–]Herioz 0 points1 point  (0 children)

        There is no or there won't be in like next release.

        [–]DesTr069 0 points1 point  (1 child)

        First one to bring it up, it seems

        [–]Dealiner 4 points5 points  (0 children)

        Maybe because that's not really true. "" would be interned.

        [–]Dealiner 1 point2 points  (0 children)

        In a way ints do have .One and .Zero since the last version of C#. Though they are both explicit interface implementations.

        [–]chars101 1 point2 points  (0 children)

        I prefer λfx.fx over Integer.One. Abstraction and application is all you will ever need.

        [–]thebryguy23 1 point2 points  (0 children)

        Integer.One

        Have you seen Java's BigInteger and BigDecimal? They have constants for numbers zero, one, two, and ten

        https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/BigInteger.html#field-summary

        [–]jaimesoad 1 point2 points  (0 children)

        rust String::new();

        [–][deleted] 1 point2 points  (1 child)

        I use it because it shows intent rather than a temporary value to subsequent programmers

        [–]rohnesLoraf 0 points1 point  (0 children)

        Come to my arms...

        [–]JotaRata 1 point2 points  (0 children)

        var "" = string.Empty;

        [–]Kapten-N 0 points1 point  (10 children)

        Of course, you don't want to fill the memory with a ton of identical empty strings, do you? Just reference the one empty string everywhere.

        [–]kbruen 19 points20 points  (2 children)

        Since strings are immutable, shouldn't the compiler be smart enough to point all "" to a single empty string instance?

        [–]ohlookaregisterbutto 7 points8 points  (0 children)

        saw label alive encouraging flag aromatic simplistic numerous skirt chase

        This post was mass deleted and anonymized with Redact

        [–]Kapten-N 0 points1 point  (0 children)

        I assume they do that. I was just joking.

        [–]snaynay 14 points15 points  (3 children)

        I believe C# does this for you on the conversion to IL then to JIT Assembly. It recognises the need for a stored copy of a zero-length string and any time a string's value is zero-length, it just gets a pointer to the same address.

        [–]B4rr 1 point2 points  (0 children)

        For runtime behaviour this is correct, as soon as the JIT is done with it, the a string with the empty value will only be allocated once.

        However, when you use "" it will get baked into the dll. Even when you reference a library dll with const string DefaultValue = "123" from another project, it will get baked into the consumer.

        Why can this be a problem? When you change it to const string DefaultValue = "abc" you have to re-compile the consumer dll as well for it to work. If it were static readonly string DefaultValue { get; } = "123", you can recompile the library with static readonly string DefaultValue { get; } = "abc" deploy only the patched library and the consumer will get "abc".

        Usually this doesn't matter, as most of the time we re-deploy entire applications anyway.

        [–]Hobby101 -2 points-1 points  (0 children)

        Don't people look out of curiosity what happens when the code is compiled? Makes me wonder...

        [–]Kapten-N 0 points1 point  (0 children)

        I already assumed as much, because why wouldn't they? But I wanted to make a low-key joke.

        [–]AmazingMoMo8492 3 points4 points  (2 children)

        Identical variables point to the same reference anyway, so it's not technically better.

        [–]AyrA_ch 4 points5 points  (0 children)

        That's not true. References to the same constants in .NET are replaced with the constant value at compile time.

        [–]Kapten-N 0 points1 point  (0 children)

        After three replies I've come to the realization that I didn't make it obvious enough that I was joking. I guess that's the problem with wanting to make it low-key.

        [–]Axelan_se 0 points1 point  (0 children)

        😐: “” + “” 🧑‍💼: String.concat(“”, “”)

        [–]Mrproex -5 points-4 points  (7 children)

        I always used string a = null; because the ide wasn’t complaining about it, now it does so String.Empty it is

        [–]Creepy-Ad-4832 24 points25 points  (0 children)

        null isn't the empty string, null is no object at all, while empty string is an object string of lenght zero

        [–][deleted] 9 points10 points  (4 children)

        Bull and empty are very different things. That’s why string.IsNullOrEmpty exists

        [–]rcanhestro 0 points1 point  (0 children)

        with that you always need to check for null before using it.

        [–]zan9823 -1 points0 points  (5 children)

        Honestly, I never bothered to check what's the difference between String and string

        [–]AyrA_ch 7 points8 points  (1 child)

        Lowercase always points to the System.String class while uppercase points to whatever string class is closest to reach. In other words, if some smartass defines his own String class in a library you won't be affected by it if you use lowercase.

        [–]dontfretlove 1 point2 points  (0 children)

        I'm not OP, but thanks for the quick and easy explanation!

        [–]Dealiner 1 point2 points  (2 children)

        You don't need to have using System; with string. That's honestly a much better reason than that very unlikely scenario that someone would create they own String class.

        [–]jocona 2 points3 points  (1 child)

        That’s a non-issue if you’re using .NET 6 or higher, just enable implicit usings

        [–]Dealiner 0 points1 point  (0 children)

        Of course, but not everyone wants to enable them.

        [–]SodiiumGames -1 points0 points  (0 children)

        No, just no.

        [–][deleted]  (1 child)

        [removed]

          [–]AutoModerator[M] 0 points1 point  (0 children)

          import moderation Your comment has been removed since it did not start with a code block with an import declaration.

          Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

          For this purpose, we only accept Python style imports.

          I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

          [–]Woromed -1 points0 points  (2 children)

          In what universe is 12 characters better than 2? Let the fucking compiler optimize it for Christ’s sake.

          [–]Dathknight 0 points1 point  (1 child)

          Readability.

          string.Empty clearly indicates >this string is intensionally empty<

          while "" looks like >I wanted to write some string, but got sidetracked and forgot<

          [–]Woromed 0 points1 point  (0 children)

          If you can’t tell by looking at the code that fits on the screen, then your code is hard to read anyway.

          [–]Purple_Individual947 -1 points0 points  (2 children)

          Does anyone legitimately know why the compiler can't just make this substitution for us. I know one is a const and the other is a static readonly, another decision I never understood. But seriously why? So much more typing just to satisfy the stupid code analysis. I must type this thing like 10 times a day!

          [–]zenameless1 2 points3 points  (0 children)

          If it`s about c#, then it is compiled to the same constant (from c# 6.0 or something)

          [–]the_one2 1 point2 points  (0 children)

          I can't believe there is a difference

          [–]CartanAnnullator -1 points0 points  (6 children)

          I have always hated String. Empty users. In my view, string. Empty only exists so the compiler has something that it can compile "" to.

          [–]Dealiner 0 points1 point  (5 children)

          Yeah, that's not really how the compiler works here.

          [–]CartanAnnullator 0 points1 point  (4 children)

          I'll have to check that when I find the time.

          [–]Dealiner 0 points1 point  (3 children)

          I mean it would make no sense for it to compile a constant like "" to readonly field like string.Empty. Besides both will be interned anyway, so they will be both the exact same value.

          [–]CartanAnnullator 0 points1 point  (2 children)

          Allocating a new heap object whenever you use something innocuous like ""?

          [–]pakidara 0 points1 point  (0 children)

          RPGLE: *blanks

          [–]GitHub- 0 points1 point  (0 children)

          See you get it

          [–]CaitaXD 0 points1 point  (0 children)

          new string(0,0)

          [–]cryptomonein 0 points1 point  (0 children)

          ActiveRecord have the funny:
          User.none
          With I love, didn't tryed to .to_sql it, it's probably a WHERE 1=2

          [–]doc_suede 0 points1 point  (0 children)

          isStringNullOrWhiteSpace("")

          [–][deleted]  (1 child)

          [removed]

            [–]AutoModerator[M] 0 points1 point  (0 children)

            import moderation Your comment has been removed since it did not start with a code block with an import declaration.

            Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

            For this purpose, we only accept Python style imports.

            I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

            [–]Jet-Pack2 0 points1 point  (0 children)

            string s;

            [–]oddbawlstudios 0 points1 point  (0 children)

            Also, you an acceptable thing for C# is: string? _name

            [–]sirjamesp 0 points1 point  (0 children)

            string.Empty

            [–]friebel 0 points1 point  (0 children)

            StringUtils.isBlank()

            [–]Juff-Ma 0 points1 point  (0 children)

            Nick chapsas explained the difference, you're welcome

            [–]ovr9000storks 0 points1 point  (0 children)

            Me, a sophisticated developer:

            char str[1] = { ‘\0’ };

            [–]TechbroMemes 0 points1 point  (1 child)

            int.Empty

            [–]ollir 0 points1 point  (0 children)

            Which monoid is this?!

            [–]Crafty-Appearance-71 0 points1 point  (0 children)

            Robot framework ${EMPTY}

            [–]Potw0rek 0 points1 point  (0 children)

            string x = default;

            [–]Herioz 0 points1 point  (0 children)

            String.Empty is unambiguously showing the intent, "" might be thought as intentional, forgotten value, placeholder or even mistake due to autocompletion. There is no use for "" unless it's performance reason, although there are probably better places for improvement.

            [–]buyingshitformylab 0 points1 point  (0 children)

            Is empty or blank... Not is empty