/[dgee]/dgee/examples/math.cs
ViewVC logotype

Diff of /dgee/examples/math.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by csmith, Fri Jan 10 22:58:16 2003 UTC revision 1.2 by csmith, Sun Sep 21 10:44:57 2003 UTC
# Line 1  Line 1 
1  namespace MathService  namespace MathService
2  {  {
3    using System;    using System;
4      using System.Web.Services;
5    using DotGNU.XmlRpc;    using DotGNU.XmlRpc;
6    
7    [WebService(Description="A collection of math functions (From examples in CookComputing.XmlRpc)", Namespace="http://nfluid.com")]    [WebService(Description="A collection of math functions (From examples in CookComputing.XmlRpc)", Namespace="http://nfluid.com")]
# Line 9  namespace MathService Line 10  namespace MathService
10      public MathService() : base() {}      public MathService() : base() {}
11    
12      [WebMethod("math.Add",Description="Add two integers and return the result")]      [WebMethod("math.Add",Description="Add two integers and return the result")]
13      public static int Add(int A, int B)      public int Add(int A, int B)
14      {      {
15        return A + B;        return A + B;
16      }      }
17    
18      [WebMethod("math.Subtract",      [WebMethod("math.Subtract",
19         Description="Subtract one integer from another and return the result")]         Description="Subtract one integer from another and return the result")]
20      public static int Subtract(int A, int B)      public int Subtract(int A, int B)
21      {      {
22        return A - B;        return A - B;
23      }      }
24    
25      [WebMethod("math.Multiply",      [WebMethod("math.Multiply",
26         Description="Multiply two integers and return the result")]         Description="Multiply two integers and return the result")]
27      public static int Multiply(int A, int B)      public int Multiply(int A, int B)
28      {      {
29        return A * B;        return A * B;
30      }      }
31    
32      [WebMethod("math.Divide",      [WebMethod("math.Divide",
33         Description="Divide one integer by another and return the result. Returns Fault Response on divide by zero")]         Description="Divide one integer by another and return the result. Returns Fault Response on divide by zero")]
34      public static int Divide(int A, int B)      public int Divide(int A, int B)
35      {      {
36        if (B == 0)        if (B == 0)
37        {        {
38          throw new XmlRpcFaultException(1001, "Divide by zero");          throw new Exception("Divide by zero");
39        }        }
40        return A/B;        return A/B;
41      }      }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26