Click here to Skip to main content
15,898,538 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron23-Nov-08 7:22
WilliamSauron23-Nov-08 7:22 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Paul Conrad23-Nov-08 7:26
professionalPaul Conrad23-Nov-08 7:26 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron23-Nov-08 7:34
WilliamSauron23-Nov-08 7:34 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Paul Conrad23-Nov-08 7:38
professionalPaul Conrad23-Nov-08 7:38 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
PIEBALDconsult24-Nov-08 5:41
mvePIEBALDconsult24-Nov-08 5:41 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron24-Nov-08 10:43
WilliamSauron24-Nov-08 10:43 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
PIEBALDconsult24-Nov-08 15:12
mvePIEBALDconsult24-Nov-08 15:12 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron24-Nov-08 21:27
WilliamSauron24-Nov-08 21:27 
PIEBALDconsult wrote:
Which is the only name that matters

Unless you target another architecture than the CLR, of course, in which case you are free to name generated symbols as you see fit. Who said that it is forbidden to directly generate IBM 360 assembly from C# ?


PIEBALDconsult wrote:
That's funny, I know that if a method is declared that has no name and returns an instance of the class, it is a constructor.


Funnier, my copy of "The C# Programming Language", ISBN 0-321-15491-6 by Anders Hejlsberg, Scott Wiltamuth & Peter Golde, on chapter 10.10 "Instance Constructors", page 344 has strong hints that they understand the constructor name to be similar to a method name, not a type name:

The identifier of a constructor-declarator must name the class in which the instance constructor is declared. If any other name is specified, a compile-time error occurs.


Similarly, my Visual Studio highlights the constructor as a method name, not as a type. But hey, Visual Studio is a Microsoft product, these are known not to follow recognized standards. And who knows, maybe this Hejlsberg guy is just a newbie Smile | :)

-- Quidquid latine dictum sit, altum sonatur.
http://streambolics.flimbase.com

S. L.

GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
PIEBALDconsult25-Nov-08 3:20
mvePIEBALDconsult25-Nov-08 3:20 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron25-Nov-08 4:05
WilliamSauron25-Nov-08 4:05 
GeneralRe: 'Item': member names cannot be the same as their enclosing type [modified] Pin
PIEBALDconsult25-Nov-08 7:51
mvePIEBALDconsult25-Nov-08 7:51 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
leppie26-Nov-08 2:12
leppie26-Nov-08 2:12 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron26-Nov-08 9:08
WilliamSauron26-Nov-08 9:08 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
leppie26-Nov-08 9:15
leppie26-Nov-08 9:15 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
WilliamSauron26-Nov-08 9:20
WilliamSauron26-Nov-08 9:20 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Redwan Albougha26-Nov-08 8:16
Redwan Albougha26-Nov-08 8:16 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
leppie26-Nov-08 2:10
leppie26-Nov-08 2:10 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Redwan Albougha26-Nov-08 8:21
Redwan Albougha26-Nov-08 8:21 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Camilo Sanchez26-Nov-08 17:55
Camilo Sanchez26-Nov-08 17:55 
GeneralRe: 'Item': member names cannot be the same as their enclosing type Pin
Redwan Albougha27-Nov-08 2:04
Redwan Albougha27-Nov-08 2:04 
GeneralC++ Gem Pin
Tom Delany11-Nov-08 11:53
Tom Delany11-Nov-08 11:53 
GeneralRe: C++ Gem Pin
Rob Grainger11-Nov-08 22:33
Rob Grainger11-Nov-08 22:33 
GeneralRe: C++ Gem Pin
PIEBALDconsult12-Nov-08 5:05
mvePIEBALDconsult12-Nov-08 5:05 
GeneralRe: C++ Gem Pin
supercat912-Nov-08 12:55
supercat912-Nov-08 12:55 
GeneralRe: C++ Gem Pin
Lutosław13-Nov-08 11:47
Lutosław13-Nov-08 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.