Вопрос по c# – c #: разница между «System.Object» и «object»

68

В C # есть ли разница между использованиемSystem.Object в коде, а не простоobject, или жеSystem.String скорее, чемstring и так далее? Или это просто вопрос стиля?

Есть ли причина, по которой одна форма предпочтительнее другой?

Error: User Rate Limit Exceededstackoverflow.com/questions/981434/… RichardOD
Error: User Rate Limit Exceeded Paolo Tedesco
Error: User Rate Limit Exceeded Tamas Czinege

Ваш Ответ

8   ответов
0

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
66

stringError: User Rate Limit Exceededglobal::System.StringError: User Rate Limit ExceededexactlyError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

public int ReadInt32() // Good, language-neutral

public int ReadInt() // Bad, assumes C# meaning of "int"

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  • nameof prohibits the use of aliases
  • When specifying an enum base underlying type, only the aliases can be used
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceededstackoverflow.com/questions/981434/…
Error: User Rate Limit Exceeded Paolo Tedesco
Error: User Rate Limit Exceeded
1

stringError: User Rate Limit ExceededSystem.StringError: User Rate Limit ExceededstringError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

EDIT:Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
3

stringError: User Rate Limit Exceededglobal::System.StringError: User Rate Limit ExceededobjectError: User Rate Limit Exceededglobal::System.Object

Error: User Rate Limit Exceededusing System;Error: User Rate Limit ExceededString / stringError: User Rate Limit ExceededObject / objectError: User Rate Limit Exceeded

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit ExceededalwaysError: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
7

Error: User Rate Limit ExceededobjectError: User Rate Limit ExceededSystem.ObjectError: User Rate Limit ExceededobjectError: User Rate Limit Exceeded

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

0

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceededdoesn'tError: User Rate Limit ExceededdoesError: User Rate Limit Exceeded
0

object, int, longError: User Rate Limit ExceededboolError: User Rate Limit Exceededtraining wheelsError: User Rate Limit ExceededSystem.Int32, System.Boolean, System.Double, System.DateTimeError: User Rate Limit Exceeded

Error: User Rate Limit Exceededdatetime?

6

Error: User Rate Limit Exceeded

Похожие вопросы