How to load project references from a sub directory in C# and VB.NET

To load project references from a sub directory in C# and VB.NET you simply need to add the element to your app.config file.

  • assemblyBinding: Contains information about assembly version redirection and the locations of assemblies.
  • configuration: The root element in every configuration file used by the common language runtime and .NET Framework applications.
  • runtime: Contains information about assembly binding and garbage collection.
  • Sample XML

    <configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <probing privatePath="bin;bin2\subbin;bin3"/>
          </assemblyBinding>
       </runtime>
    </configuration>
    

    Please rate this snippet

    How to reload a ViewController in IOS using Objective-C

    To reload a UITableViewController in IOS using Objective-C you can simply use the reloadData method of the ViewController.

    //MyTablViewController is a UITableViewController
    [MyTableViewController.tableView reloadData] 
    

    Please rate this snippet

    How to clear notifications in IOS using Objective-C

    To clear notifications in IOS using objective-c you can use the snippet below.

    Sample Objective-C

    //in method: application:didFinishLaunchingWithOptions
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    
    //in method: application:didReceiveRemoteNotification
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1]; //we need to to increment first
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    

    Please rate this snippet

    How to get the path of the active app.config file in C# and VB.NET

    To get the path of the active app.config file in C# and VB.NET you can use the following snippet

    Sample C#

    AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
    

    Sample VB.NET

    AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
    

    Please rate this snippet

    How to exit an application in C# and VB.NET

    To exit an application in C# and VB.NET you can use the following snippet.

    Sample C#

    System.Windows.Forms.Application.Exit(0); // WINFORM
    Environment.Exit(0); // CONSOLE APP
    Application.Shutdown(); // WPF
    

    Sample VB.NET

    System.Windows.Forms.Application.[Exit](0) ' WINFORM
    Environment.[Exit](0) ' CONSOLE APP
    Application.Shutdown() ' WPF
    

    Please rate this snippet

    How to set the ios bookmark icon in HTML

    To set the ios bookmark icon in HTML you can use the following snippet.

    Sample HTML

    <link rel="apple-touch-icon" href="iOs_Icon.png"/>
    

    If your icon is already glossy, you can prevent the device from adding its own gloss by using.

    Sample HTML

    <link rel="apple-touch-icon-precomposed" href="iOs_Icon.png"/>
    

    Please rate this snippet