1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu C# Căn Bản Toàn Tập part 8 pptx

4 304 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Operators
Chuyên ngành C# Programming
Thể loại Bài giảng
Định dạng
Số trang 4
Dung lượng 120,93 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Indexing for arrays and indexers [| Conditional the Ternary Operator ?: Type information sizeof unsafe code only is typeof as Overflow exception control checked unchecked Indirection and

Trang 1

Operators

Assignment = += -= *= /= %q= &= |= ˆ=<<=>>=

Member access (for objects and structs) |

Indexing (for arrays and indexers) [|

Conditional (the Ternary Operator) ?:

Type information sizeof (unsafe code only) is typeof as

Overflow exception control checked unchecked

Indirection and Address * -> & (unsafe code only) []

Câu sau đây có nghĩa là x bằng với 3:

x=3;

Nếu chúng ta muốn so sánh x với một giá trị ching ta st dung ki hiéu sau =:

if (x = 3)

Operator Shortcuts

Bảng dưới đây trình bày một danh sách đầy đủ của shortcut operators có giá trị trong C#:

Trang 2

‘Shortcut Operator Tương đương

t+, ++x x=x+Ï

x>>=y x=x>>y

Thí dụ :

int x =5;

if (++x == 6)

{

Console WriteLine("This will execute");

j

if (x++ == 7)

{

Console WriteLine("This won't");

)

x t+=5;

x=xt+5;

The Ternary Operator

Cu phap :

condition ? true_value : false_value

Thi du:

int x = 1;

string s = x.ToString() + ”" ”;

Trang 3

s t= (x == 1? "man": "men");

Console WriteLine(s);

is

int i= 10;

if (1 is object)

{

Console WriteLine("i is an object");

)

sizeof

string s="A string";

unsafe

{

Console WriteLine(sizeof(int));

)

Operator Precedence

Group

Unary

Multiplication/Division

Addition/Subtraction

Bitwise shift operators

Relational

Comparison

Bitwise AND

Bitwise XOR

Bitwise OR

Boolean AND

Boolean OR

Ternary operator

Assignment

Operators () [] x++ x new typeof sizeof checked unchecked + -!~-++x x and casts

* 1%

+

<< >>

<><=>=is as

—— |=

&

^

|

&&

?:

Ngày đăng: 15/12/2013, 02:15

HÌNH ẢNH LIÊN QUAN

Bảng dưới đây trình bày một danh sách đầy đủ của shortcut  operators có giá trị trong C#: - Tài liệu C# Căn Bản Toàn Tập part 8 pptx
Bảng d ưới đây trình bày một danh sách đầy đủ của shortcut operators có giá trị trong C#: (Trang 1)

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w