How to Delete Cookies?
HttpCookie currentUser=HttpContext.Current.Request.Cookies["CookiesValue"];
HttpContext.Current.Response.Cookies.Remove("CookiesValue");
currentUser.Expires=DataTime.Now.AddMinutes(-20);
currentUser.value=null;
HttpContext.Current.Response.SetCookie(currentUser);
Delegate is an object which holds the references to a method within the delegate object.It is type safe object and invoking the method asynchronously manner.
Advantage of Delegates
1 Improved the performance of Application
2 Call a method asynchronous.
Type of Delegate
1. Single Delegate and
2 Multicast Delegate
3 Generic Delegate
Single Delegate :-A delegate is need to pass single parameter as reference to a method with the delegate object.
Multicast Delegate: - When we need to pass more than one parameter as reference to a method within delegate object.
--- String and number Reverse--
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{ //---reverse string ----
//Console.WriteLine("Enter a number for reverse");
//int number = Convert.ToInt32(Console.ReadLine());
//int revers = 0;
//while (number > 0)
//{
// int rem = number % 10;
// revers = (revers * 10) + rem;
// number = number / 10;
//}
//Console.WriteLine(revers);
//Console.ReadLine();
//-- Reverse string--
Console.WriteLine("enter your name");
string name = Console.ReadLine();
var temp = "";
for (int i = name.Length - 1; i >= 0; i--)
{
temp += name[i].ToString();
}
Console.WriteLine(temp);
Console.ReadLine();
}
}
}
----- Duplicate character in string --
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter a word");
string data = Console.ReadLine();
RemoveDuplicatecharacter(data);
}
static string RemoveDuplicatecharacter(string value)
{
string result = string.Empty;
string temp = string.Empty;
foreach (char data in value)
{
if (temp.IndexOf(data) == -1)
{
temp += data;
result += data;
}
}
Console.WriteLine(result);
Console.Read();
return result;
}
}
}
HttpCookie currentUser=HttpContext.Current.Request.Cookies["CookiesValue"];
HttpContext.Current.Response.Cookies.Remove("CookiesValue");
currentUser.Expires=DataTime.Now.AddMinutes(-20);
currentUser.value=null;
HttpContext.Current.Response.SetCookie(currentUser);
Delegate is an object which holds the references to a method within the delegate object.It is type safe object and invoking the method asynchronously manner.
Advantage of Delegates
1 Improved the performance of Application
2 Call a method asynchronous.
Type of Delegate
1. Single Delegate and
2 Multicast Delegate
3 Generic Delegate
Single Delegate :-A delegate is need to pass single parameter as reference to a method with the delegate object.
Multicast Delegate: - When we need to pass more than one parameter as reference to a method within delegate object.
--- String and number Reverse--
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{ //---reverse string ----
//Console.WriteLine("Enter a number for reverse");
//int number = Convert.ToInt32(Console.ReadLine());
//int revers = 0;
//while (number > 0)
//{
// int rem = number % 10;
// revers = (revers * 10) + rem;
// number = number / 10;
//}
//Console.WriteLine(revers);
//Console.ReadLine();
//-- Reverse string--
Console.WriteLine("enter your name");
string name = Console.ReadLine();
var temp = "";
for (int i = name.Length - 1; i >= 0; i--)
{
temp += name[i].ToString();
}
Console.WriteLine(temp);
Console.ReadLine();
}
}
}
----- Duplicate character in string --
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter a word");
string data = Console.ReadLine();
RemoveDuplicatecharacter(data);
}
static string RemoveDuplicatecharacter(string value)
{
string result = string.Empty;
string temp = string.Empty;
foreach (char data in value)
{
if (temp.IndexOf(data) == -1)
{
temp += data;
result += data;
}
}
Console.WriteLine(result);
Console.Read();
return result;
}
}
}
No comments:
Post a Comment