April 22, 2010

Overloading Web Services


The procedure to solve this problem is very easy. Start each method with a Web Method attribute. Add Description property to add a description of web method and MessageName property to change web method name.
namespace TestOverloadingWebService
{
[WebService(Namespace = "http://tempuri.org/", Description=" <b> Function
overloading in Web Services </b>")]
public class OverloadingInWebService : System.Web.Services.WebService
{
[WebMethod(MessageName = "AddInt", Description = "Add two integer
Value", EnableSession = true)]
public int Add(int a, int b)
{
return (a + b);
}
[WebMethod(MessageName = "AddFloat", Description = "Add two Float
Value", EnableSession = true)]
public float Add(float a, float b)
{
return (a + b);
}
}
}

April 20, 2010

JavaScript Question

Q1. Disbable back option by java script
Ans.    window.history.go(+1) use in java script;
         or
onunload =window.history.go(-1) in body tag

Q2. we can disable the right click using 
Ans. <body oncontextmenu="return false">
</body>

Virtual functions in C#

Virtual functions implement the concept of polymorphism are the same as in C# except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.

class Shape
{
    public virtual void Draw()
    {
        Console.WriteLine("Shape.Draw") ;
    }
}


class Rectangle : Shape
{
    public override void Draw()
    {
        Console.WriteLine("Rectangle.Draw");
    }
}