C#: ¿nombres de métodos con la primera letra en mayúscula?


¿Cuál es el estándar de C# para capitializar nombres de métodos? Es:

MyClass.MyMethod()

O

MyClass.myMethod()

?

Author: informatik01, 2011-03-08

8 answers

El primero está justo después de Convenciones de Capitalización. Net

 29
Author: il_guru,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:30:40

Primero es estándar en C#, el segundo es un estándar en Java

 28
Author: Øyvind Bråthen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:29:14

El método C# normalmente está en PascalCase. Ver las directrices aquí.

 4
Author: jb.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:31:26

Pascal case es el estándar para.NET en general y C# en particular.

 1
Author: Anton Gogolev,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:30:57

Microsoft recomienda utilizar El primer Enfoque.

 1
Author: Nasser Hadjloo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:30:59

No creas que hay un estándar, es lo que tú y aquellos con los que trabajas prefieran. El más común que he visto es PascalCasing para Métodos y Camel para variables privadas, etc.

 0
Author: F.B. ten Kate,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:30:57

Los estándares de nomenclatura. NET dicen que debe usar Pascal Case:

Ver Directrices para nombrar métodos

 0
Author: jwwishart,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:32:16

Camel case vs proper case. El Camino Correcto 100% Aprobado (TM) para C# es este último.

 -2
Author: kprobst,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-13 03:53:33