Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, May 21, 2015

How to Get Public key token in Visual Studio?

Hi ,

We can get easily public key token as per below steps

http://blogs.msdn.com/b/kaevans/archive/2008/06/18/getting-public-key-token-of-assembly-within-visual-studio.aspx

If you getting any error command check in you are machine where sn.exe is located .

C:\Program Files (x86)\Microsoft SDKs\Windows\

or

C:\Program Files \Microsoft SDKs\Windows\

and replace sn.exe(command ) location as per you machine.


 

Tuesday, May 12, 2015

sqlite MvvmCross Plugin Loading Issue and Unable to load DLL 'sqlite3

Solution 1:

For this issue  download sqlite3.dll from http://www.sqlite.org/download.html File name  - sqlite-dll-win32-x86-3071602.zip That will contain sqlite3.dll. add dll in your  project's bin directory so that SQLite-net can find it.

Solution 2:
add below nuget package in your project .same name differnt nuget package is avilable so please find below attribute nuget package 
  • Created by: Frank A. Krueger
  • Id: sqlite-net-pcl
  • NuGet link: sqlite-net-pcl
More Info : http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/databases/

Thursday, January 22, 2015

C# 6.0 New Feature

C# 6.0 New Feature

How to get C# Updated Version?

      Two ways we can update C# 6.0

      Updated Visual Studio into VS 2014
      Or
        Installing Roslyn Package in VS 2013

$ Sign :

Its simplify String indexing

Example:

var value = new Dictionary()  {
           // using inside the initialize
                $first = "Nikhil"
            }

Assign value to member

C# 5.0
 C# 6.0
Value[first] =”Nikhile”
Value. $first = “Nikhil”

Exception Filters:

Exception filter already support in Vb.net now C#.net as well start to support .Exception filter is nothing but in catch block we can specify If Condition.
IF condition is fail inside catch block statement it won’t execute.

         C# 5.0
 C# 6.0
          try
            {       }
            catch (Exception ex)
            {       }

  Try  {
     throw new Exception("Null Error");
          }
catch (Exception ex) if (ex.Message == " IndexError")
            {
                // this one will not execute.
            }
            catch (Exception ex) if (ex.Message == " Null Error ")
            {
             // this one will execute
            }

await in Catch block and finally block :

Previous version C# not support await keyword in catch block and finally block ,Now in c# 6.0 start supporting

         C# 5.0
 C# 6.0

            try
            {
                DoSomething();
            }
            catch (Exception)
            {
             //Its not Support here
                await LogService.LogAsync(ex);
            }

            try
            {
                DoSomething();
            }
            catch (Exception)
            {
               // New feature it will support
                await LogService.LogAsync(ex);
            }

Declaration Expression:

This feature allows you to declare local variable in the middle of an expression. It is as simple as that but really destroys a pain.

         C# 5.0
 C# 6.0
Int  Qty;
Int.TryParse(txtnumber.Text, out Qty)

Int.TryParse(txtnumber.Text, Int out Qty)


Auto Property Initialize:

In C# 6.0 added new feature called auto property initialize like below

public class Person
    {
        // You can use this feature on both
        //getter only and setter / getter only properties

        public string FirstName { get; set; } = "Nikhil";
        public string LastName { get; } = "Jagathesh";
    }


Primary constructors:

A primary constructor allows us to define a constructor for a type and capture the constructor parameters to use in initialization expressions throughout the rest of the type definition.  Here’s one simple example:

//this is primary constructor
public Class Money(string currency, decimal amount)
{
    public string Currency { get; } = currency;
    public decimal Amount { get; } = amount;
}

Dictionary Initialize:

         C# 5.0
 C# 6.0
Dictionary country = new Dictionary()
            {
                { "India", "TN" },
                { "United States", "Washington" },
                { "Some Country", "Some Capital " }
            };
Dictionary country = new Dictionary()
            {
                // Look at this!
                ["Afghanistan"] = "Kabul",
                ["Iran"] = "Tehran",
                ["India"] = "Delhi"
            };

Null-Conditional Operator

 This is an exception that almost always indicates a bug because the developer didn’t perform sufficient null checking before invoking a member on a (null) object.
Look below new feature very interesting

         C# 5.0
 C# 6.0
public static string Truncate(string value, int length)
{
  string result = value;
//this pain work for us
  if (value != null) // Skip empty string check for elucidation
  {
    result = value.Substring(0, Math.Min(value.Length, length));
  }
  return result;
}
public static string Truncate(string value, int length)
{         
  return value?.Substring(0, Math.Min(value.Length, length));
}