2

I downloaded some C# code off the net. I quickly realized they were using C# 6.0 because they were using automatic property initializes. I also saw this syntax:

var keyId = $"{clientId} - {key}";

a few lines later, keyid is referenced in an equality statement.

var prot = new KeyStore.PasswordProtection(service.ToCharArray());
var ks = LoadKeyStore(clientId, service);
var aliases = ks.Aliases();

while(aliases.HasMoreElements)
{
    var alias = aliases.NextElement().ToString();

    if(alias == keyId)

So it seems like its expecting keyId to be parsed or processed in some way.

I cannot seem to find anything on this syntax. I looked up C# operators. Is this just a syntax error?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
tatmanblue
  • 1,176
  • 2
  • 14
  • 30
  • It is new syntax in C# 6. It is similar to `String.Format` except you pipe the variables directly into the string. – Sam Dec 19 '15 at 15:37

0 Answers0