Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I have been known to do things like bool arrayContainsSomestring = new List<string>(stringArray).Contains("somestring"); when all I cared about was that particular piece of information and the LINQ extension methods are not available. Works fine, and fits inside an if() condition without needing to jump through hoops. Of course, you want a garbage-collected language if you're writing code like that. Commented Nov 8, 2012 at 9:07
  • If it's language-agnostic, why add java and c# as well? :) Commented Nov 8, 2012 at 11:01
  • I'm curious, what is the functionality of this 'one method'? It would help a great deal in determining what the best approach is in the specific scenario, but interesting question nonetheless! Commented Nov 8, 2012 at 11:06
  • @StevenJeuris: I've stumbled upon this issue in various situations, but in the current case it's a method that imports data into the local database (loads it from a web server, does some manipulations and stores it in the database). Commented Nov 8, 2012 at 11:28
  • 2
    If you always call the method when you create the instance, why not make it an initialization logic inside the constructor? Commented Nov 8, 2012 at 12:53