dot net tips, DotNet tips, .Net Tips,Dot Net tips and tricks,Dot Net Solutions, OOPS Concept in C#,SQL Server, LinQ, Ajax, Java script, JQuery, Server Error details, daily .net tips and tricks , DotNet Interview Questions.
What is IIS? Why is it used?
It makes our computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server.
IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions.
The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.
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
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
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();
}
}
}
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();
}
}
}
Subscribe to:
Posts (Atom)