VB.NET VS C# VS C++ VS JAVA
1_ الاستعانة بمكتبة برمجية :
|
VB.NET
|
|
Imports System.IO
|
|
C#
|
|
Using
system.io;
|
|
C++
|
|
using
namespace System::IO;
|
|
Java
|
|
import
java. io.Writer;
|
2_طرق تعريف المتغيرات :
|
VB.NET
|
|
Dim x AS
Integer
|
|
C#
|
|
Int x;
|
|
C++
|
|
Int
x;
|
|
Java
|
|
Int x;
|
3_المتغيرات النصية :
|
VB.NET
|
|
Dim x AS
string
|
|
C#
|
|
String x;
|
|
C++
|
|
String
^x;
|
|
Java
|
|
String
x;
|
4_تقسيم النصوص :
|
VB.NET
|
|
Dim
newarray As String() = g.Split("_")
|
|
C#
|
|
string[]
newarray = g.Split("_");
|
|
C++
|
|
array<String^> ^newarray = g->Split("_");
|
|
Java
|
|
String
testString = "java_";
java.util.Arrays.toString(testString.split("_"));
|
5_دمج النصوص :
|
VB.NET
|
|
Dim s3
As String = [String].Concat(s1, s2)
|
|
C#
|
|
string
s3 = String.Concat(s1, s2);
|
|
C++
|
|
String
^s3 = String::Concat(s1, s2);
|
|
Java
|
|
String
s3 = s1.concat(s2);
|
6_التحويل من
والي متغير نصي :
|
VB.NET
|
|
Dim x As
Integer = Integer.Parse("1")
Dim v As
Boolean = Boolean.Parse("True")
|
|
C#
|
|
int x =
int.Parse("1");
bool v =
bool.Parse("True");
|
|
C++
|
|
int x =
int.Parse("1");
bool v =
bool.Parse("True");
|
|
Java
|
|
int x = Integer.parseInt("1");
boolean v =
Boolean.parseBoolean("True");
|
7_التحويل من
متغير الي آخر :
|
VB.NET
|
|
Dim x As
String = m.ToString()
|
|
C#
|
|
string x
= m.ToString();
|
|
C++
|
|
String ^x = m->ToString();
|
|
Java
|
|
String x = m.toString();
|
8_بناء
متغير نصي :
|
VB.NET
|
|
Label1.Text
= label2.Text + ".com"
|
|
C#
|
|
Label1.Text
= label2.Text + ".com";
|
|
C++
|
|
label1->Text = label2->Text + ".com";
|
|
Java
|
|
jLabel1.setText(jLabel2.getText() +
".com");
|
9_التحويل
من متغير الي آخر :
|
VB.NET
|
|
Dim
wsite As New System.Text.StringBuilder(Text1.Text)
wsite.Append(".com")
|
|
C#
|
|
System.Text.StringBuilder
wsite = New System.Text.StringBuilder(Text1.Text);
wsite.Append("@hotmail.com");
|
|
C++
|
|
System::Text::StringBuilder ^wsite = gcnew
System::Text::StringBuilder(label1->Text);
wsite->Append("@hotmail.com");
|
|
Java
|
|
StringBuilder wsite = new
StringBuilder(jLabel1.getText()); wsite.append("@hotmail.com");
|
10_لأضافة
تاريخ معين :
|
VB.NET
|
|
Dim dt
as DateTime = New DateTime(2012, 1, 1)
Label1.Text=dateTimePicker1.Value
Dim dt
as DateTime = New DateTime.Now
|
|
C#
|
|
DateTime
dt = new DateTime(2012, 1, 1);
Label1.Text=dateTimePicker1.Value;
DateTime
dt = new DateTime(2012, 1, 1);
|
|
C++
|
|
DateTime
dt = DateTime(2012, 1, 1);
label1->Text
= dateTimePicker1->Text;
Console::WriteLine(DateTime::Now);
|
|
Java
|
|
java.util.Date dt = new java.util.Date(2012,
1, 1);
label1.setText(jCalendarCombo1.getDate().toLocaleString());
System.out.println(new java.util.Date(2012, 1, 1));
|
11_التحويل
من متغير أصغر الي صحيح :
|
VB.NET
|
|
Private
Function power(ByVal number As Integer) As Integer
Return
number Xor 2
End
Function
‘at any event put..
Dim x As
Short = 5
power(x)
|
|
C#
|
|
int
power(int number)
{
return
number^2;
}
//at any
event put..
Short
x=5;
power(x);
|
|
C++
|
|
int power(int number)
{
return number^2;
}
//at any event put..
short x = 5;
power(x);
|
|
Java
|
|
int power(int number)
{
return number^2;
}
//at any event put..
short x = 5;
power(x);
|
12_تحويل المتغيرات :
|
VB.NET
|
|
Dim myByte
As Short , myInt As Integer
myByte =
Convert.ToByte(myInt)
|
|
C#
|
|
short myByte; int myInt;
myByte =
Convert.ToByte(myInt);
|
|
C++
|
|
short myByte; int myInt;
myByte = Convert::ToByte(myInt);
|
|
Java
|
|
//There
is no Convert To Method in java so you need to use different way …
short
myByte = 5; int myInt = 1; long x = myByte + myInt;
System.out.println(x);
|
13_جمل الشرط :
|
VB.NET
|
|
If x = 5
Then
Console.WriteLine("five")
Else
Console.WriteLine("notFive")
End If
|
|
C#
|
|
if
(x==5)
Console.WriteLine("five");
else
Console.WriteLine("notFive");
|
|
C++
|
|
if (x == 5)
cout<<"five";
else
cout<<" notFive ";
|
|
Java
|
|
if (x ==
5)
System.out.print("five");
else
System.out.print(" notFive ");
|
14_جمل الشرط :
|
VB.NET
|
|
If x
> 90 Then
Console.WriteLine("ممتاز")
ElseIf x
>= 50 Then
Console.WriteLine("ناجح")
Else
Console.WriteLine("راسب")
End If
|
|
C#
|
|
if (x
> 90)
{
Console.WriteLine("ممتاز
");
}
else if
(x >=50)
{
Console.WriteLine("ناجح
");
}
else
{
Console.WriteLine("راسب
");
}
|
|
C++
|
|
if (x > 90)
{
Console::WriteLine("ممتاز ");
}
else if (x >= 50)
{
Console::WriteLine("ناجح
");
}
else
{
Console::WriteLine("راسب
");
}
|
|
Java
|
|
if (x > 90)
{
System.out.println("ممتاز ");
}
else if (x >= 50)
{
System.out.println("ناجح
");
}
else
{
System.out.println("راسب
");
}
|
15_دمج الشروط :
|
VB.NET
|
|
If (x
< 90 Or x > 50) And (Not name = "ahmed") Then
End If
|
|
C#
|
|
if ((x
< 90 || x>50) && (!name="ahmed"));
|
|
C++
|
|
if ((x < 90 || x>50) && (name !=
"ahmed"));
|
|
Java
|
|
if ((x
< 90 || x>50) && (name != "ahmed"));
|
16_التحقق من شرط واحد علي الأقل للتنفيذ :
|
VB.NET
|
|
If id
> 0 And SearchForID>0 Then
' do something
End If
|
|
C#
|
|
if (id
> 0 & SearchForID>0) {
// do something
}
|
|
C++
|
|
if (id > 0 &
SearchForID(id) > 0)
{
// do something
}
|
|
Java
|
|
if (id > 0 &
SearchForID(id) > 0)
{
// do something
}
|
17_التحقق من أكثر من شرط في وقت واحد :
|
VB.NET
|
|
If id
> 0 AndAlso SearchForID>0 Then
' do something
End If
|
|
C#
|
|
if (id
> 0 && SearchForID>0) {
// do something
}
|
|
C++
|
|
if)id > 0 &&
SearchForID(id) > 0(
{
// do something
}
|
|
Java
|
|
if)id > 0 &&
SearchForID(id) > 0(
{
// do something
}
|
18_حالات التعدد الشرطية :
|
VB.NET
|
|
Select
Case )x(
Case 90
Console.WriteLine("ممتاز")
Case 50
Console.WriteLine("ناجح")
End
Select
|
|
C#
|
|
switch
(x)
{
case 90:
Console.WriteLine("ممتاز
");
break;
case 50:
Console.WriteLine("ناجح
");
break;
}
|
|
C++
|
|
switch (x)
{
case 90:
cout<<("ممتاز ");
break;
case 50:
cout<<("ناجح ");
break;
}
|
|
Java
|
|
switch (x)
{
case 90:
System.out.println("ممتاز
");
break;
case 50:
System.out.println("ناجح
");
break;
}
|
: For الحلقة
التكرارية_19
|
VB.NET
|
|
For i As
Integer = 0 To 9
Console.WriteLine(i) Next
|
|
C#
|
|
for (int
i = 0; i < 10; i++)
{Console.WriteLine(i);
}
|
|
C++
|
|
for (int
i = 0; i < 10; i++)
{cout<<I; }
|
|
Java
|
|
for (int
i = 0; i < 10; i++)
{ System.out.print(I);}
|
: باستخدام القفزات For الحلقة التكرارية_20
|
VB.NET
|
|
For i As Integer = 0 To 9 Step 2
Console.WriteLine(i)
Next
|
|
C#
|
|
for (int i = 0; i < 10; i+=2)
{Console.WriteLine(i); }
|
|
C++
|
|
for (int i = 0; i < 10; i+=2)
{cout<<I; }
|
|
Java
|
|
for (int i = 0; i < 10; i+=2)
{System.out.printIn(i); }
|
: باستخدام القفزات While الحلقة التكرارية_21
|
VB.NET
|
|
Dim x As Integer = 0
While x < 10
Console.WriteLine(x)
x +=1
End While
|
|
C#
|
|
int x = 0;
while (x < 10)
{
Console.WriteLine(x);
x++;
}
|
|
C++
|
|
int x = 0;
while (x < 10)
{
Console.WriteLine(x);
x++;
}
|
|
Java
|
|
int x = 0;
while (x < 10)
{
System.out.println(x);
x++;
}
|
: Do While الحلقة التكرارية_22
|
VB.NET
|
|
Dim s As String
Do
s = Console.ReadLine()
Console.WriteLine(inp)
Loop While s <> "exit"
|
|
C#
|
|
string s;
do
{
s = Console.ReadLine();
Console.WriteLine(s);
}
while(s!="exit");
|
|
C++
|
|
String ^s;
do
{
s = Console::ReadLine();
Console::WriteLine(s);
}
While (s != "exit");
|
|
Java
|
|
String s;
do
{
try {
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
s = in.readLine();
System.out.println(s);
} catch (IOException ex) {
Logger.getLogger(Form1.class.getName()).log(Level.SEVERE,
null, ex);
}
while (s != "exit");
|
: For Each الحلقة التكرارية_23
|
VB.NET
|
|
Dim x As Integer() = {10, 20, 30, 40}
For Each i As Integer In x
Console.WriteLine(i)
Next
|
|
C#
|
|
int[] x = { 10, 20, 30, 40 };
foreach (int i in x)
Console.WriteLine(i);
|
|
C++
|
|
Array<int> ^x = { 10, 20, 30, 40 };
for each (int i in x)
Cout<<i;
|
|
Java
|
|
//هذا النوع من الحلقات غير
متوافر
int[] x = {01,20,30,40};
for (int i = 0; i < x.length; i++) {
System.out.println(i);
}
|
: Try Method أسلوب أقتناص الأخطاء_24
|
VB.NET
|
|
try
'code
Catch
ex As Exception
End
try
|
|
C#
|
|
try
{
//code
}
catch (Exception ex)
{
}
|
|
C++
|
|
try
{
//code
}
catch (Exception
^ex)
{
}
|
|
Java
|
|
try
{
//code
}
catch (RuntimeException ex)
{
}
|
: Hello World طباعة جملة _25
|
VB.NET
|
|
Module Module1
Sub Main()
Console.Write("Hello World")
Console.ReadKey()
End Sub
End Module
|
|
C#
|
|
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static
void Main(string[] args)
{
Console.Write("Hello
World");
Console.ReadKey();
}
}
}
|
|
C++
|
|
//.h file code:
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Text;
namespace ConsoleApplication4
{
private ref class
Program
{
static void Main(array<String^>
^args);
};
}
//.cpp file code:
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Text;
namespace ConsoleApplication4
{
void
Program::Main(array<String^> ^args)
{
Console::Write("Hello
World");
Console::ReadKey();
}
}
|
|
Java
|
|
package ConsoleApplication1;
import System.*;
import System.Collections.Generic.*;
import System.Text.*;
//h file code:
public class Program
{
private static void Main(String[]
args)
{
System.out.print")Hello World("
}
}
//cpp file code:
|
: أسلوب كتابة
الدوال _26
|
VB.NET
|
|
Private
Function sum(ByVal number1
As Integer, ByVal
number2 As Integer)
As
Integer
Dim total
As Integer = number1 + number2
Return
total
End Function
|
|
C#
|
|
static int sum(int number1, int number2)
{
int total = number1 + number2;
return total;
}
|
|
C++
|
|
static int sum(int number1, int number2)
{
int total =
number1 + number2;
return total;
}
|
|
Java
|
|
private static int sum(int number1, int number2)
{
int total =
number1 + number2;
return total;
}
|
: أسلوب
أستدعاء الدوال _27
|
VB.NET
|
|
Dim result As Integer = sum(5, 8)
Console.Write(result)
Console.ReadKey()
|
|
C#
|
|
int result = sum(5, 8);
Console.Write(result);
Console.ReadKey();
|
|
C++
|
|
int result = sum(5, 8);
cout<<result;
|
|
Java
|
|
int result = sum(5, 8);
System.out.print(result);
|
: Methods أسلوب كتابة الطرق _28
|
VB.NET
|
|
Private Sub printmsg(ByVal msg As String)
Console.WriteLine(msg)
End Sub
|
|
C#
|
|
void printmsg(string msg)
{
Console.WriteLine(msg);
}
|
|
C++
|
|
void printmsg(string msg)
{
Cout<<msg;
}
|
|
Java
|
|
private void printmsg(string msg)
{
System.out.printIn(msg);
}
|
: Out الوظيفة _29
|
VB.NET
|
|
Private Shared Sub sum(ByVal number1 As Integer,
ByVal number2 As Integer, ByRef
total As Integer)
total = number1 + number2
End Sub
'usage
Dim result As Integer
sum(5, 8, result)
|
|
C#
|
|
static void sum(int number1, int number2, out int
total)
{
total =
number1 + number2;
}
//usage
sum(5, 8,out result);
|
|
C++
|
|
static void sum(int number1, int number2,
[System::Runtime::InteropServices::Out] int %total)
{
total = number1
+ number2;
}
//usage
sum(5,
8,out result);
|
|
Java
|
|
private static void sum(int
number1, int number2,int total)
{
total = number1 + number2;
}
//usage
sum(5,
8,int result);
|
: byref الارسال
بالمرجع _30
|
VB.NET
|
|
Private Sub [sub](ByRef number1 As Integer, ByRef number2
As Integer) _
Dim result As
Integer = number1 - number2 _
Return result
End Sub
|
|
C#
|
|
static void sub(ref int number1, ref int number2)
{
int result
= number1 - number2;
return
result;_
}_
|
|
C++
|
|
private :Void sub(int %number1, int %number2)
{
int
result = number1 - number2;
//return
result; in c++ void function can not return values
}
|
|
Java
|
|
private int sub(tangible.RefObject<Integer>
number1, tangible.RefObject<Integer> number2)
{
int
result = number1.argvalue - number2.argvalue;
return result;
}
//with using a package…
package tangible;
public class RefObject<T> {
public
T argvalue;
public
RefObject(T refarg)
{
argvalue
= refarg;
}
}
|
: تعريف أبسط
المصفوفات_31
|
VB.NET
|
|
Dim intarray As Integer() = New
Integer(4)
|
|
C#
|
|
int [] intarray = new int[5];
|
|
C++
|
|
array<int> ^intarray = gcnew array<int>(5);
|
|
Java
|
|
int[] intarray = new int[5];
|
: تعريف أبسط
المصفوفات _32
|
VB.NET
|
|
Dim intarray
As Integer() = New Integer() {15, 20, 13}
|
|
C#
|
|
int[]
intarray = new int[] { 15, 20, 13 };
|
|
C++
|
|
array<int> ^intarray = gcnew
array<int> {15, 20, 13};
|
|
Java
|
|
int[] intarray = new int[] {15, 20,
13};
|
: المصفوفات متعددة
الابعاد_33
|
VB.NET
|
|
Dim matrix As
Integer = New Integer(2, 2)
‘To use it..
matrix(1, 2)
= 20
|
|
C#
|
|
int matrix =
new int[2,2];
//To use it..
matrix[1,2]=20;
|
|
C++
|
|
int matrix = gcnew array<int,
2>(2,2);
//To use it..
matrix[1,2] = 20;
|
|
Java
|
|
int[][] matrix
= new int[2][2];
//To use it..
matrix[1][2] = 20;
|
: Structures التراكيب
_34
|
VB.NET
|
|
Structure Car
Public carNumber As Integer
Public year As Integer
Public factory As String
End Structure_
‘usage..
Dim ahmedcar As New Car()
ahmedcar.carNumber = 1000
ahmedcar.factory = "Nissan"
ahmedcar.year
= 2007
|
|
C#
|
|
struct Car
{
public int carNumber;
public int year;
public string factory;
};
//usage..
Car ahmedcar = new Car();
ahmedcar.carNumber = 1000;
ahmedcar.factory = "Nissan";
ahmedcar.year
= 2007;
|
|
C++
|
|
struct Car
{
public int carNumber;
public int year;
public string factory;
};
//usage..
Car ahmedcar = new Car();
ahmedcar.carNumber = 1000;
ahmedcar.factory = "Nissan";
ahmedcar.year = 2007;
|
|
Java
|
|
public class Car
{
public int carNumber = new public();
public int year = new public();
public String factory = new public();
}
//usage..
Car ahmedcar = new Car();
ahmedcar.carNumber = 1000;
ahmedcar.factory = "Nissan";
ahmedcar.year = 2007;
|
: Struct أنشاء الدوال داخل ال _35
|
VB.NET
|
|
Structure License
Public UserName As String
Public yearsToFinish As Integer _
Public Sub renew(ByVal periode As Integer)
yearsToFinish += periode
End Sub
End Structure
|
|
C#
|
|
struct License
{
public string UserName;
public int yearsToFinish;
public void renew(int periode)
{
yearsToFinish += periode;
}
}
|
|
C++
|
|
struct License
{
public string UserName;
public int yearsToFinish;
public void renew(int periode)
{
yearsToFinish += periode;
}
}
|
|
Java
|
|
public class Car
{
public int carNumber = new public();
public int year = new public();
public void renew(int periode)
{
yearsToFinish += periode;
}
}
|
: أسلوب
التأشير_36
|
VB.NET
|
|
me
EX:
me.text = “Form”
|
|
C#
|
|
this
EX:
this.text=”From”;
|
|
C++
|
|
this
EX:
this->Text= “Form”
|
|
Java
|
|
this
EX:
this.setTitle("Form");
|
: التعامل مع مربع النص_37
|
VB.NET
|
|
TextBox1.Text = “Friendassist”
|
|
C#
|
|
textBox1.Text = “Friendassist”;
|
|
C++
|
|
textBox1->Text = “Friendassist”;
|
|
Java
|
|
jTextField1.setText("Friendassist");
|
: جعل مربع
النص لا يقبل سوي أرقام _38
|
VB.NET
|
|
Private Sub TextBox1_KeyPress(ByVal
sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
If (e.KeyChar < "0"c Or e.KeyChar > "9"c)
Then
e.Handled = True
End If
End Sub
|
|
C#
|
|
private void TextBox1_KeyPress(object
sender, System.Windows.Forms.KeyPressEventArgs e) {
if ((e.KeyChar < '0' | e.KeyChar > '9')) {
e.Handled = true;
}}
|
|
C++
|
|
private: System::Void
textBox1_KeyPress(System::Object^
sender, System::Windows::Forms::KeyPressEventArgs^ e) {
if ((e->KeyChar < '0' | e->KeyChar
> '9')) {
e->Handled
= true;
}}
|
|
Java
|
|
private void
jTextField1KeyReleased(java.awt.event.KeyEvent evt) {
String text = jTextField1.getText();
if(text.length()>=0&&!text.contains("0")&&
!text.contains("1")&&
!text.contains("2")&&
!text.contains("3")&&
!text.contains("4")&&
!text.contains("5")&&
!text.contains("6")&&
!text.contains("7")&&
!text.contains("8")&&
!text.contains("9")) {
jTextField1.setText("");
} else {
}
}
|
: تفريغ جميع حقول النص في آن واحد_39
|
VB.NET
|
Public Sub ClearTextBox(ByVal Root As Control)
For Each Ct As Control In Root.Controls
If TypeOf Ct Is TextBox Then
CType(Ct, TextBox).Clear()
End If
Next End Sub ‘Usage ..ClearTextBox(Me) |
|
C#
|
private void ClearAllTextBox(Control m){
foreach (Control cc in m.Controls){
if (cc.GetType() ==typeof ( TextBox))
((TextBox)cc).Clear();} } //usage..ClearAllTextBox(this); |
|
C++
|
void ClearAllTextBox(TComponent *m){ for (int i = 0; i < m->ComponentCount; i++)
if (m->Components[i]->ClassName()==L"TEdit")
static_cast<TEdit* >(m->Components[i])->Clear();
}
//usage..
ClearAllTextBox(this); |
|
Java
|
public void ClearAllTextBox(FrameView m){ for(int i=0;i<m.getComponent().getComponentCount();i++){
if (m.getComponent().getComponent(i).getClass().toString().equals
("class javax.swing.JTextField"))
((javax.swing.JTextField)m.getComponent().getComponent(i)).setText(null);
} //usage..ClearAllTextBox(this); |
: تعريف أبسط الفئات_40
|
VB.NET
|
|
Namespace ConsoleApplication1
Class Person
‘Functions and Main
function of code ….
End Class
End Namespace
|
|
C#
|
|
namespace ConsoleApplication1
{
class Person
{
// Functions and Main function of code ….
}
}
|
|
C++
|
|
namespace ConsoleApplication1
{
private ref class Person
{
// Functions and Main
function of code ….
};
}
//.cpp file code:
namespace ConsoleApplication1
{
}
|
|
Java
|
|
package ConsoleApplication1;
public class Person
{
// Functions and Main
function of code ….
}
|
: الفئات المعلنة _41
|
VB.NET
|
|
Class Person
Public FirstName As String
Public Last-Named As String
Public Age As Integer
End Class
|
|
C#
|
|
class Person
{
public string FirstName;
public string LastName;
public int Age;
}
|
|
C++
|
|
using namespace System;
private ref class Person
{
public:
String ^FirstName;
String ^LastName;
int Age;
};
|
|
Java
|
|
import System.*;
public class Person
{
public String FirstName;
public String LastName;
public int Age;
}
|
: تعريف كائنات الفئة
أو أعلان الكائن
_42
|
VB.NET
|
|
Dim boy As New Person()
boy.Age = 15
boy.FirstName = "Ahmed"
boy.LastName = "Gamal"
Dim girl As New Person()
girl.Age = 15
girl.FirstName =
"Ahmed"
girl.LastName = "nahed"
|
|
C#
|
|
Person boy = new Person();
boy.Age = 15;
boy.FirstName =
"Ahmed";
boy.LastName = "Gamal";
Person girl = new Person();
girl.Age = 15;
girl.FirstName =
"Ahmed";
girl.LastName =
"nahed";
|
|
C++
|
|
Person ^boy = gcnew Person();
boy->Age = 15;
boy->FirstName = "Ahmed";
boy->LastName = "Gamal";
Person ^girl = gcnew Person();
girl->Age = 15;
girl->FirstName =
"Ahmed";
girl->LastName = "nahed";
|
|
Java
|
|
Person boy = new Person();
boy.Age = 15;
boy.FirstName = "Ahmed";
boy.LastName = "Gamal";
Person girl = new Person();
girl.Age = 15;
girl.FirstName = "Ahmed";
girl.LastName = "nahed";
|
: تعريف المتغيرات
السابقة من خلال مصفوفة _43
|
VB.NET
|
|
Dim MyEmpolyee As Person() = New
Person(2) {}
MyEmpolyee(0) = New Person()
MyEmpolyee(0).FirstName =
"Ahmed"
MyEmpolyee(0).LastName =
"Gamal"
MyEmpolyee(0).Age = 15
|
|
C#
|
|
Person [] MyEmpolyee = new
Person[3];
MyEmpolyee[0] = new Person();
MyEmpolyee[0].FirstName =
"Ahmed";
MyEmpolyee[0].LastName =
"Gamal";
MyEmpolyee[0].Age = 15;
|
|
C++
|
|
array<Person^> ^MyEmpolyee =
gcnew array<Person^>(3);
MyEmpolyee[0] = gcnew Person();
MyEmpolyee[0]->FirstName =
"Ahmed";
MyEmpolyee[0]->LastName =
"Gamal";
MyEmpolyee[0]->Age = 15;
|
|
Java
|
|
Person[] MyEmpolyee = new Person[3];
MyEmpolyee[0] = new Person();
MyEmpolyee[0].FirstName =
"Ahmed";
MyEmpolyee[0].LastName =
"Gamal";
MyEmpolyee[0].Age = 15;
|
: Constructors
المشيدات _44
|
VB.NET
|
|
Public Sub New(ByVal
userfirstname As String)
FirstName = userfirstname
End Sub
|
|
C#
|
|
public Person(string
userfirstname)
{
FirstName = userfirstname;
}
|
|
C++
|
|
public:
Person(String ^userfirstname);
<missing_class_definition>::Person(String
^userfirstname)
{
FirstName = userfirstname;
}
|
|
Java
|
|
Person(String ^userfirstname);
public final
<missing_class_definition>.Person(String userfirstname)
{
FirstName = userfirstname;
}
|
: تهيئة المشيد في
ابسط الحالات _45
|
VB.NET
|
|
Public Sub New()
Console.WriteLine("new
object")
End Sub
|
|
C#
|
|
public Person()
{
Console.WriteLine("new
object");
}
|
|
C++
|
|
public:
Person();
private:
<missing_class_definition>::Person()
{
Console::WriteLine("new
object");
}
|
|
Java
|
|
Person();
public
<missing_class_definition>.Person()
{
System.out.println("new
object");
}
|
: التعامل مع المجلدات _46
|
VB.NET
|
|
'Delete Folder
System.IO.Directory.Delete("Folder_path")
'Create new Folder
System.IO.Directory.CreateDirectory
("Folder_path")
'Move folder to new location
System.IO.Directory.Move("Folder_old_path",
"Folder_neh")
|
|
C#
|
//Delete Folder System.IO.Directory.Delete("Folder_path"); //Create new Folder System.IO.Directory.CreateDirectory ("Folder_path");
//Move folder to new location System.IO.Directory.Move("Folder_old_path", "Folder_neh"); |
|
C++
|
|
//Delete Folder
System::IO::Directory::Delete("Folder_path");
//Create new Folder
System::IO::Directory::CreateDirectory("Folder_path");
//Move folder to new location
System::IO::Directory::Move("Folder_old_path",
"Folder_neh");
|
|
Java
|
|
//Delete
Folder
(new java.io.File("New
folder")).delete();
//Create new
Folder
(new java.io.File("New
folder")).mkdir();
//Move folder
to new location
// File (or
directory) to be moved
File file =
new File("filename");
// Destination
directory
File dir = new
File("directoryname");
// Move file
to new directory
boolean
success = file.renameTo(new File(dir, file.getName()));
|
copyright © Friendassist 2012 ... All Rights Reserved
جميع الحقوق محفوظة لفريندأسيست .. في حال النقل يجب ذكر المصدر
طريقة فريدة للتعليم .
ردحذفجزاكم الله خير الجزاء وغفر لك ولوالديك ولكل المسلمين والمسلمات والمؤمنين والمؤمنات الأحياء منهم والأموات .. آمين
ورمضان كريم
أخوك Kslawy
جزاك الله خيرا و كل عام وانتم بخير ..
حذف