|
A Piece of API (Application Programming Interface) : is a set of
programming instructions, rather software to software
interactions, to represent an user interface. An API can pose as a
Software as Service (Saas), as we use some precompiled routines with
some commands than starting from ground zero. |
Windows API :
- Windows Environment (Shell)
- User Input and Messaging
- Graphic and Multimedia
- Devices
- And So on.....
- C# and API
- Interoperative Services
- using System.Runtime.InteropServices;
- Collections : Generic
- using System.Collections.Generic;
|
|
|
Test this code :
//File location : C:\BareBone_CSharp\Source_Code\Template
using System;// Namespace Declaration
using System.Collections.Generic;
using System.Linq;
//csc test.cs
// Program start class
class CsharpTemplate
{
// Main begins program execution.
static void Main(string[] str1)
{
int n1;int n2;int calc;string a , b;
Console.Write("Enter smaller int to n1':");
a = Console.ReadLine();
Console.Write("Enter larger int to 'n2':");
b = Console.ReadLine();
// with void return will quit command prmpt
if((a =="") & (b==""))
{Console.WriteLine("So Long Command"); return ; }
try
{
// processing as LINQ
n1 =int.Parse(a); n2 =int.Parse(b);
Func<int, int, int> funcAdd = (x, y) => x + y;
calc=funcAdd.Invoke(n1, n2);
Console.Write(" Addtion Operation :");
Console.WriteLine(Convert.ToString(calc));
//
Func<int, int, int> funcDevide = (x, y) => y/x ;
calc=funcDevide.Invoke(n1, n2);
Console.Write(" Divison Operation :");
Console.WriteLine(Convert.ToString(calc));
}
catch (Exception ex)
{
Console.WriteLine("Exit With Grace on Error /n");
Console.WriteLine(ex.ToString());
}
// Console.ReadLine();
}
}
|
Testing : Adding all inputs, with no aberrations.
Fetching variable "a" and "b" with Console.ReadLine();
|
|
Testing if statement block:
Testing Try Block
|
Java and C# @ command line
|
|
|
|
|
|