S
@rstinejr said:@Speakerphone Dude said:@C-Octothorpe said:@pjt33 said:List pageRoleList = null;pageRoleList = GetPageRoleList(pageRole);Agreed, this reeks of junior developer code-monkey.
If someone was to declare the list without assigning a value, then in Visual Studio there would be a wiggle under the variable with a warning about using uninitialized variables. Adding = null or = String.Empty like for rolepagefound will make the wiggle go away.
But if the coder bulls through and writes the next line (the assignment), then the squiggle goes away.
I don't think you can blame this on VisualStudio -- probably it's the violent video games. Or the Nanny State.
Ok I have an improved theory: what if the guy has been working in VB for years, where (by default) there is an annoying modal popup warning about any problem on the line when you press Enter. This person could have been traumatized and would feel the need to fix immediately any problem reported by Visual Studio, hence fixing the wiggle with a = null. Well that does not explain why he did not do the value assignment immediately; however if that person also has a background in a language where people usually declare variables before doing assignments (such as Cobol), then the mystery is solved.
So here is the explanation for this part of the code: the programmer is a 50 year old who spent half his career working with Cobol and the other half with VB, and he just switched to C#. Obvious.