installing-iis-on-windows-vista-and-windows-7

Please find the below link that takes you to success end for install the IIS on windows 7.


http://www.iis.net/learn/install/installing-iis-7/installing-iis-on-windows-vista-and-windows-7

Default Access Modifier in C#

This is very basic thing we should come to know, so that i just recall this concept in this post.

An enum has default modifier as public

A class has default modifiers as Internal .


An interface has default modifier as public

A struct has default modifier as Internal

A methods, fields, and properties has default access modifier as "Private" if no modifier is specified.

  
public
The type or member can be accessed by any other code in the same assembly or another assembly that references it.

private
The type or member can be accessed only by code in the same class or struct.

protected
The type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class.

internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.

Unable to cast object of type WhereSelectListIterator to type 'System.IConvertible'.


Unable to cast object of type WhereSelectListIterator to type 'System.IConvertible'.

When you find above error you can use single to avoid the error. 

item.title = Convert.ToString(lstobj.Where(x => x.ID == item.id).Select(x => x.IdentifiersName).Single());

IDictionary in C#

Dictionary represent a collection of keys and values pair of data.
The Dictionary class is a generic class and can store any data types.
The Dictionary class constructor takes two parameters (generic type), first for the type of the key and second for the type of the value.

Dictionary  Example program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iDictionary
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, Int32> sampleDic = new Dictionary<string, int>();
            sampleDic.Add("Babu", 1111);
            sampleDic.Add("Prabhu", 2222);
            sampleDic.Add("Harshad",2223);
            Console.WriteLine("IDictionary Value");
            Console.ReadKey();
            foreach (KeyValuePair<string, Int32> item in sampleDic)
            {
                Console.WriteLine("Key = {0} ,Value = {1}", item.Key, item.Value);
            }
            Console.ReadKey();
            Console.WriteLine("Thanks");
            Console.ReadKey();
            Console.WriteLine("----------------");
            Console.WriteLine("Dictionary Prperties");
            Console.WriteLine("Count: {0}", sampleDic.Count);
            Console.WriteLine("----------------");
            Console.WriteLine("Dictionary KeyCollection Prperties");
            Dictionary<string, Int32>.KeyCollection keys = sampleDic.Keys;
            foreach (string key in keys)
            {
                Console.WriteLine("Key : {0}", key);
            }
            Console.WriteLine("----------------");
            Console.WriteLine("Dictionary ValueCollection properties ");
            Dictionary<string, Int32>.ValueCollection val = sampleDic.Values;
            foreach (Int32 item in val)
            {
                Console.WriteLine("Value : {0}", item);
            }
            Console.ReadKey();
        }
    }
}

Get duplicate rows of a table


Get duplicate rows of a table
  
SELECT COUNT(*), colname FROM TABLE GROUP BY colname HAVING COUNT(*) > 1

this keyword

The this is a keyword, It refers to the current instance of the class.
It can be used to access members from within constructors,instance accessors instance methods and instance successor.


public class Demo4this
        {
            int age;
            string name;
 
            public Demo4this(int age, string name)
            {
               
                this.age = age;
                this.name = name;
             }
 
            public void Show()
            {
                Console.WriteLine("Your Name : " + name); 
                Console.WriteLine("Your Age :" + age.ToString());
             }
     }
static void Main(string[] args)
        {
            int age1;
            string name1;

            Console.WriteLine("Enter your name : ");
            name1=Console.ReadLine();
 
            Console.WriteLine("Enter your age : " );
            age1=Int32.Parse(Console.ReadLine());
 
            Demo4this obj = new Demo4this(age1, name1);
 
            obj.Show();
            Console.ReadLine();
            Console.ReadLine(); 
        }
    }
}