Here is a bit of a quiz: What does this program print? using System; using System.Collections.Generic; class Person { public String Name { get; set; } } class Example { static void Main() { var people = new List<Person> { new Person { Name = “George Washington” } }; Console.WriteLine( people.Contains( new Person { Name [...]
Monthly Archives: October 2009
All types are not compared equally
29-Oct-09Know your framework
13-Oct-09What is wrong with the following program? using System; using System.Net; using System.IO; using System.Text; class Example { static void Main() { Console.WriteLine( getWebPage(“http://example.com”)); } static String getWebPage(String url) { WebRequest request = WebRequest.Create(url); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader streamReader = new StreamReader(stream); return streamReader.ReadToEnd(); } } At first glace there [...]
ASP.NET, JavaScript, and the mangled ID
08-Oct-09Many times I see folks struggling with a problem like this: I really want to get at an ASP.NET control with JavaScript but once the control has rendered, the ID of the control gets mangled to look something like ctl00_Content_foo_bar. How do I go about working with this control in JavaScript since the ID is [...]