Yes, they're different. Yours makes more sense if you only want to check once. His makes sense if you need to check every time, although obviously the setter and private member are redundant.
To get pedantic with yours:
c# code:
private bool? _isDataFeed;
public bool isDataFeed
{
get
{
if (!_isDataFeed.HasValue)
{
string header = Request.Headers["X-Requested-With"];
_isDataFeed = ((!String.IsNullOrEmpty(header)) && header.Equals("xmlhttprequest", StringComparison.InvariantCultureIgnoreCase));
}
return _isDataFeed.Value;
}
set
{
_isDataFeed = value;
}
}
Notes: Parentheses around !String.IsNullOrEmpty check, otherwise the bang negates the entire condition; Using Nullable<T>.Value and HasValue properties saves unnecessary boxing and unboxing; using String.Equals for case-insensitive comparison saves creating string instances (which is expensive because String is a class, not a struct).
EDITED: 19 Dec 2008 15:43 by RENDLE