0

I understand that there is probably no empirical difference between "string" and "String" but it still seems odd to me that this interface:

List<Platypus> GetPlatypus(String duckbillName, String pwd, String pondNum);

...when implemented in a class via right-clicking the interface name and selecting "Implement Interface" results in the slightly different:

public List<Platypus> GetPlatypus(string duckbillName, string pwd, string pondNum)

I realize there's probably no real diff between "string" and "String," but still I would expect the interface type of string to be reproduced in the

implemented class. Is it this way because it doesn't matter which type is used, and "string" is simply the default, or...???

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    There is no functional difference whatsoever between `string` and `String`. – Jeroen Vannevel Aug 11 '14 at 20:32
  • 1
    There isn't just "no functional difference", there's no difference at all, and as such no way to know by examining the interface which form was used (also, what whitespace choices where made, whether namespaces where included in the class name, and so on). Doing the sort of thing you would expect would require magic or fortune-telling from the IDE. – Jon Hanna Aug 11 '14 at 21:53
  • @Jon: Or, it could just copy what is contained in the Interface; it obviously has access to it. – B. Clay Shannon-B. Crow Raven Aug 11 '14 at 22:15
  • 1
    @B.ClayShannon copy what? The interface is some CIL where the parameters are all, in this case, of type `[mscorlib]System.String`. There's no reason why it would have access to the C# originally used to create it, or that said C# may not have changed while maintaining the same interface, or that the interface was ever written in C# in the first place. To the produced CIL these sort of differences in the C# are like the font used to print a recipe are to a cake. – Jon Hanna Aug 11 '14 at 23:17
  • @Jon: But this is happening at design-time; surely the subsystem that implements the interface can "look at" the Interface during design time. As it turns out, it's a moot point, though, so I'll stay mute on this subject after this. – B. Clay Shannon-B. Crow Raven Aug 11 '14 at 23:23
  • 1
    @B.ClayShannon the interface is CIL metadata, so it has to decide on which way to translate `[mscorlib]System.String` into C#. Unless you're suggesting it should look at the actual C# for the minority of times where the source is available (because it's in the same solution), which would be a lot of work to special-case something it already can do through the approach taken for all other cases. – Jon Hanna Aug 12 '14 at 11:19

0 Answers0