By

admin
dynamic x = new ExpandoObject(); x.NewProp = string.Empty; You may have seen the above but below is the good stuff var x = new ExpandoObject() as IDictionary<string, Object>; x.Add("NewProp", string.Empty); x.Add("Shout", new Action(() => { Console.WriteLine("Hellooo!!!"); })); x.Shout();
Read More
First test to see if the object is a castable class if that doesn’t work for basic types int string etc then you will use Convert.ChangeType.. if (readData is T) { return (T)readData; } try { return (T)Convert.ChangeType(readData, typeof(T)); } catch (InvalidCastException) { return default(T); }
Read More
public static void CleanExit(string reponseText = null) { if (String.IsNullOrEmpty(reponseText) == false) { HttpContext.Current.Response.Write(reponseText); } try { //Sends the response buffer HttpContext.Current.Response.Flush(); // Prevents any other content from being sent to the browser HttpContext.Current.Response.SuppressContent = true; //Directs the thread to finish, bypassing additional processing HttpContext.Current.ApplicationInstance.CompleteRequest(); //Suspends the current thread Thread.Sleep(1); } catch { } finally...
Read More
//Full URL string url = HttpContext.Current.Request.Url.ToString(); // http://localhost:1234/test/test.aspx?cool=true string url = HttpContext.Current.Request.Url.AbsoluteUri; // http://localhost:1234/test/test.aspx string path = HttpContext.Current.Request.Url.AbsolutePath; // /test/test.aspx string host = HttpContext.Current.Request.Url.Host; // localhost Here it is in a function: public enum URLType { Full, URI, Path, Host } public static string GetCurrentURL(URLType type = URLType.Full) { switch (type) { case URLType.URI: return...
Read More
Dynamically Load JQuery easily using the console, this is great for plugins and pages that do //Load jQuery library using plain JavaScript (function(){ var newscript = document.createElement('script'); newscript.type = 'text/javascript'; newscript.async = true; newscript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'; (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript); })();
Read More
Software Development Team In Denver meets
Hyper Byte Labs Specializes In Software Development As the city grows, more small businesses pop up all over the Denver metro area. Many start-up businesses find that they need software development from a professional company such as Hyper Byte Labs. Our experienced team knows several ways that we can add value to your new business. […]
Read More
1 2