Q:

Does "string" = "string" cost more memory

As part of the refactor I make to this code, I've come across this snippet of code and I'm debating what's more correct / efficient?
Before:
string CutHeadAndTail(string pattern)
{
    if (pattern[0] == '*')
    {
        pattern = pattern.Substring(1);
    }
    if (pattern[pattern.Length - 1] == '*')
    {
        pattern = pattern.Substring(0, pattern.Length - 1);
    }
    return pattern;
}

After:
private string RemoveAllowedAstrisks(string pattern)
{
    pattern = pattern[0] == '*'?pattern.Substring(1): pattern;
    pattern = pattern[pattern.Length - 1] == '*' ? pattern.Substring(0, pattern.Length - 1) : pattern;

    return pattern;
}

What's better?
I am thinking about the line  pattern = pattern[0] == '*'?pattern.Substring(1): pattern;
Means, from readability point of view I prefer the second. But in the other hand, the meaning of this expression is the below two options:

pattern[0]=='*' --> in such case pattern will changed to pattern.Substring(1)
else --> pattern = pattern

While if I will choose the first way (ignoring the naming etc.) I have just the first option:

if (pattern[0] == '*')
{
   pattern = pattern.Substring(1);
}

return pattern;

The bottom line: Does the line pattern = pattern cost more memory?

A:

I have checked the generated IL code to see what is created.
IL_000e: ldloc.0      // hello
IL_000f: ldc.i4.0     
IL_0010: callvirt     instance char [mscorlib]System.String::get_Chars(int32)
IL_0015: ldc.i4.s     42 // 0x2a
IL_0017: beq.s        IL_001c
IL_0019: ldloc.0      // hello
IL_001a: br.s         IL_0023
IL_001c: ldloc.0      // hello
IL_001d: ldc.i4.1     
IL_001e: callvirt     instance string [mscorlib]System.String::Substring(int32)
IL_0023: stloc.0      // hello

As you can see, the ldloc.0 is exectued in case the : branch of the logical statement is run (IL_0019). Right after that the code jumps to IL_0023 which executes the stloc.0.
This could be an issue with value types, but string is a reference type and such assignment does not affect the memory at all. To prove it, I have created a big string and run a few value = value assignments. The heap size never changed.
string hello = new string('a', 3202340);
hello = hello;
hello = hello;

