Виртуальная песочница (тм)

Tuesday, July 6, 2010

.NET vs Delphi: the "as" operator


public object Execute(object request) {
if (request is Request)
return service.Execute(request as Request);
else
throw new NotImplementedException();
}


CA1800 : Microsoft.Performance : 'request', a parameter, is cast to type 'Request' multiple times in method 'Wrapper.Execute(object)'. Cache the result of the 'as' operator or direct cast in order to eliminate the redundant isint instruction.<br />

Microsoft хочет, чтобы было так:


public object Execute(object request)
{
var r = request as Request;
if (r!=null)
return service.Execute(r);
else
throw new NotImplementedException();
}


потому что, как оказывается, "the "as" operator never throws an exception. Instead, if the indicated conversion is not possible, the resulting value is null." Read more...

Saturday, July 3, 2010

Javatar .Not

YouTube - Javatar .Not


See also "RailsEnvy.com: All Ruby on Rails Commercials"

Update 9-JuL-2010. С YouTube видео уже убрали: "This video is no longer available due to a copyright claim by Alley Music Corp." Однако по запросу "javatar .not" Google находит "about 44,200 results" in "0.35 seconds". Например, на New JavaZone2010.

Объяcнение шутки про Scala Johanson: http://www.scala-lang.org/ Read more...