Language: C#
Func<t> Async delegates - Nice 'n easy
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; }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

