C# nesneye yönelik bir programlama dilidir. Nesneye yönelik programlama metodolojisinde, çeşitli neslelerin birbiri ile iletişimde bulunarak bir action bildirmesidir. Bu action belki diğer bir metodu çağırmak olabilir.
using System;
namespace RectangleApplication
{
class Rectangle
{
// member variables
double length;
double width;
public void Acceptdetails()
{
length = 4.5;
width = 3.5;
}
public double GetArea()
{
return length * width;
}
public void Display()
{
Console.WriteLine("Length: {0}", length);
Console.WriteLine("Width: {0}", width);
Console.WriteLine("Area: {0}", GetArea());
}
}
class ExecuteRectangle
{
static void Main(string[] args)
{
Rectangle r = new Rectangle();
r.Acceptdetails();
r.Display();
Console.ReadLine();
}
}
}
Kod derlendiği zaman,
Length: 4.5
Width: 3.5
Area: 15.75
C# Keywords
Reserved Keywords |
abstract |
as |
base |
bool |
break |
byte |
case |
catch |
char |
checked |
class |
const |
continue |
decimal |
default |
delegate |
do |
double |
else |
enum |
event |
explicit |
extern |
false |
finally |
fixed |
float |
for |
foreach |
goto |
if |
implicit |
in |
in (generic modifier) |
int |
interface |
internal |
is |
lock |
long |
namespace |
new |
null |
object |
operator |
out |
out (generic modifier) |
override |
params |
private |
protected |
public |
readonly |
ref |
return |
sbyte |
sealed |
short |
sizeof |
stackalloc |
static |
string |
struct |
switch |
this |
throw |
true |
try |
typeof |
uint |
ulong |
unchecked |
unsafe |
ushort |
using |
virtual |
void |
volatile |
while |
|
|
|
|
|
Contextual Keywords |
add |
alias |
ascending |
descending |
dynamic |
from |
get |
global |
group |
into |
join |
let |
orderby |
partial (type) |
partial (method) |
remove |
select |
set |
|
|
|