I want to know what is the difference between them and what is the possible way to use them.
Absolutely no difference. Even at the level of IL. In C #, it stringis an alias of the actual System.String.NET type. As for possible use, use it when you want to present an empty string in your application. There was a lot of discussion about the difference between string.Emptyand "", and the general consensus is that you should use the one that suits you best and make your code more readable, which is obviously subjective.
string
System.String
string.Empty
""
No difference. stringis an aliasSystem.String
No difference, it’s just predefine text or name for compiler. string =String (class) int =Int32 (struct) long= Int64 (struct) decimal = Decimal (struct)
String .
Just FUI: There is one difference between aliases - Int32 and int, for example:
You can write:
enum A : int { }
But you cannot write:
enum A : Int32 { }
As far as I know, there is no difference. At least no difference in results.
You may use it like this: string mystring = "blah"; mystring = string.Empty;
or
String mystring = "blah"; mystring = String.Empty;
Source: https://habr.com/ru/post/1766333/More articles:time difference between mine and betfair server - phpEvents with a few touches of MotionEvent are mixed and affect each other (see. Demo video) - androidiPad: measuring / detecting a closed area with the touch of a finger on the screen (not just touching the coordinates) - cocoa-touchPrivate Template Templates / Visibility Framework - c ++How to close (not kill) another application that does not have a visible window? (C #) - c #How to make Haskell Network.Browser do gzip compression? - haskellDo I need to change IV while encrypting multiple packets in CFB mode? - erlangошибка проверки на стороне клиента - javascriptC ++ 0x auto keyword value, for example? - c ++Javascript - Web CSS Editor - javascriptAll Articles