=================================================================
Methods of dictionary class
1. TryGetValue()
2.Count()
3.Remove()
4.Clear()
5.Using LINQ extension methods with Dictionary
6.Different ways to convert an array into a dictionary.
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
public class MainClass
{
public static void Main()
{
Customer Customer1 = new Customer()
{
ID = 101,
Name = “Malla”,
Salary = 5000
};
Customer Customer2 = new Customer()
{
ID = 102,
Name = “Mark”,
Salary = 5000
};
Customer Customer3 = new Customer()
{
ID = 119,
Name = “Mla”,
Salary = 5000
};
Dictionary<int, Customer> dictionaryCustomer = new Dictionary<int, Customer>();
dictionaryCustomer.Add(Customer1.ID, Customer1);
dictionaryCustomer.Add(Customer2.ID, Customer2);
dictionaryCustomer.Add(Customer3.ID, Customer3);
Console.WriteLine(“Total Items = {0}”, dictionaryCustomer.Count);
Console.ReadLine();
dictionaryCustomer.Remove(110);
Console.ReadLine();
//Customer cust;
//if (dictionaryCustomer.TryGetValue(101, out cust))
//{
// Console.WriteLine(“ID = {0}, Name = {1}, Salary = {2}”, cust.ID, cust.Name, cust.Salary);
// Console.ReadLine();
//}
//else
//{
// Console.WriteLine(“The Key is not found”);
//}
}
public class Customer
{
public int ID { get; set; }
public string Name { get; set; }
public int Salary { get; set; }
}
}
}
Expansion : These snippets allows the code snippet to be inserted at the cursor.
SurroundsWith: These snippets allows the code snippets to be placed around a selected piece of code
Refactoring: These snippets are used during code refactoring.
Control K X for intellesense in visual studio
right click in visual studio program and select the insert snippets > visual c# > for loop
CODE SNIPPET MANAGER
Tool > code snippet manager
OPTIONAL PARAMETERS
FOUR WAYS
1) Use parameter arrays
2) Method overloading
3) Specify parameter defaults
4) Use OptionalAttribute that is present in System.Runtime.InteropService namespace
1)Use parameter arrays
using System;
using System.Text;
namespace ConsoleApplication4
{
public class MainClass
{
public static void Main()
{
AddNumber(10, 20 new object[] {30,50,40});
}
public static void AddNumber(int firstNumber, int SecondNumber, params object[] restofNumbers)
{
int result = firstNumber + SecondNumber;
if(restofNumbers != null)
{
foreach(int i in restofNumbers)
{
result += i;
}
}
Console.WriteLine(“Sum = ” + result);
Console.ReadLine();
}
}
}
2) Making method parameters optional using Method overloading
using System;
using System.Text;
namespace ConsoleApplication4
{
public class MainClass
{
public static void Main()
{
AddNumber(10, 20, new int[] {30,40});
}
// over loading method
public static void AddNumber(int firstNumber, int SecondNumber)
{
AddNumber(firstNumber, SecondNumber, null);
}
public static void AddNumber(int firstNumber, int SecondNumber, params int[] restofNumbers)
{
int result = firstNumber + SecondNumber;
if(restofNumbers != null)
{
foreach(int i in restofNumbers)
{
result += i;
}
}
Console.WriteLine(“Sum = ” + result);
Console.ReadLine();
}
}
}
3) Specify parameter defaults
using System;
using System.Text;
namespace ConsoleApplication4
{
public class MainClass
{
public static void Main()
{
AddNumber(10, 20, new int[] {30,40});
}
// optional parameters appears after all the parameters
public static void AddNumber(int firstNumber, int SecondNumber, int[] restofNumbers = null)
{
int result = firstNumber + SecondNumber;
if(restofNumbers != null)
{
foreach(int i in restofNumbers)
{
result += i;
}
}
Console.WriteLine(“Sum = ” + result);
Console.ReadLine();
}
}
}
NAMED PARAMETERS
using System;
using System.Text;
namespace ConsoleApplication4
{
public class MainClass
{
public static void Main()
{
Test(1,c:20);
}
// optional parameters appears after all the parameters
public static void Test(int a, int b = 10, int c = 20)
{
Console.WriteLine(“a = ” + a);
Console.WriteLine(“b = ” + b);
Console.WriteLine(“c = ” + c);
Console.ReadLine();
}
}
}
4) Making Method parameters optional by using OptionalAttributes
TOP MARKETING TOOLS FOR MICROSOFT DYNAMICS CRM
Check out the various email marketing tools for microsoft dynamics crm as follows through the below link, as i thought it would be helpful to someone like me, before choosing one.
http://www.encorebusiness.com/blog/dynamics-crm-marketing-automation-tools/