New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Func<t> Async delegates - Nice 'n easy

234 Views
Copy Code Show/Hide Line Numbers
public void LogSnippetViewAsync(string snippetId, string ipAddress, string userAgent)
{
    Func<string, string, string, bool> del = this.LogSnippetView; 
    del.BeginInvoke(snippetId, ipAddress,userAgent,null,null);            
}
 
public bool LogSnippetView(string snippetId, string ipAddress, string userAgent)
{
    if (string.IsNullOrEmpty(userAgent))
        return false;
 
    userAgent = userAgent.ToLower();
 
    if (!(userAgent.Contains("mozilla") || userAgent.StartsWith("safari") ||
        userAgent.StartsWith("blackberry") || userAgent.StartsWith("t-mobile") ||
        userAgent.StartsWith("htc") || userAgent.StartsWith("opera")))
        return false;
 
    this.Context.LogSnippetClick(snippetId, ipAddress); // stored proc
 
    return true;
}
 
 
 
by Rick Strahl
  September 24, 2009 @ 3:31pm
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate