Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
İÇİNDEKİLER VII
İÇİNDEKİLER
1 VISUAL STUDIO MENÜLERİ VE EKRAN GÖRSELLERİ 1
C# Nedir? 1
.NET Framework 1
Visual Studio Programını Başlatmak 2
Start Page (Başlangıç Sayfası) 3
File Menüsü (Dosya) 5
New Project (Yeni Bir Proje Başlatmak) 5
Open Folder in File Explorer (Projenin Klasör Yolunun Açılması) 7
Build Solution (Projeleri Derlemek) 7
Open Project (Varolan Projeleri Açmak) 10
Add New Project, Close and Close Solution 11
Save All (Projenin Tümünü Kaydetmek) 11
Recent Project and Solutions, Yazıcıda Kod Satır Numaralarını Görmek 12
Edit Menüsü (Düzen) 12
Undo Redo (Geri Sar, İleri Sar) 12
Cut (Keserek Kopyala), Copy (Kopyala), Paste (Yapıştır), Delete (Sil) 13
Find and Replace (Bul ve Değiştir) 13
Cycle Clipboard Ring, Mouse Sürükle Bırak 14
Advanced 15
Intellisense 15
Intellisense Pascal Case 16
Generate Method, Organize Usings 16
Remove Unused Usings/Kullanılmayan Using ifadeleri 17
View Menüsü (Görünüm) 17
Code 17
Designer, Architecture Explorer 18
Code Definition Window 19
Object Browser, Error List 20
Start Page, Property Pages 21
C#_ile_Projeler_ICINDEKILER.indd 7 26.12.2013 16:28
PROJELER İLE C# VE SQL SERVERVIII
Toolbox 22
Toolbox En Çok Kullanılan Kontrolleri Gruplandırma 24
Toolbox Penceresinden Forma Kontrol Sürükleme 24
Properties Window 25
Properties Penceresi İkonları, Solution Explorer 26
Project Menüsü 29
Build Menüsü 31
Debug Mod ile Release Mod Farkı, Projenin EXE Hali 33
Tools Menüsü 33
Code Snippets Manager 34
Visual Studio Ayarlarını Yedeklemek (Import and Settings Wizard) 35
Customize (Menülerin Düzenlenmesi) 37
Kendi Menümüzü Hazırlamak, Options 38
Environment 39
General, Fonts and Colors 39
Project and Solution 40
Text Editor, General 40
Window Menüsü 44
Float 44
Pin Tab,Auto Hide,New Horizontal/Vertical Tab Group, Reset Window 45
Windows 45
Pencereleri Sürükleme 46
Bir Kod Bloğunda Sütun Seçmek 47
Alt Tuşu İle Kullanılan Harfler 48
Debug Menüsü 49
Projeyi Çalıştırmak 49
F5 49
Ctrl+F5, Shıft+F5, Toggle Breakpoint, Step, Step Over 50
Step Into, Step Out, QuickWatch 51
Proje Çalıştırmak ve Kodları Debug Etmek 51
Pencereler (Windows) 52
C#_ile_Projeler_ICINDEKILER.indd 8 26.12.2013 16:28
İÇİNDEKİLER IX
Advanced, Intellisense, Snippets 53
Refactor, Edit 54
F Tuşları 55
Diğer Ctrl Tuşları, Resolve 56
2 PROJE GELİŞTİRMEK, FORM PROPERTIES VE EVENTS 57
İlk Form Uygulaması, Design, Form Özellikleri (Properties) 57
Form Appearance Properties: 59
BackColor 59
ForeColor, FormBorderStyle 60
BackgroundImage, BackgroundImageLayout 61
Font, RightToLeft 63
Text 64
Form Behavior Properties 64
AllowDrop, ContextMenuStrip, DoubleBuffered 64
Enabled 65
Form Data, DataBindings, Tag 65
Form Design 65
Name Özelliği, Language, Localizable, Locked 65
Form Focus, CausesValidation 66
Form Layout 66
AutoScroll, AutoSize, AutoSizeMode 66
MaximumSize 66
MinimumSize, Padding, Size, StartPosition, WindowState 67
Form Misc, AcceptButton 67
Form Window Style 68
CancelButton, HelpButton, Icon, MainMenuStrip 68
MaximizeBox, MinimizeBox 68
Opacity, ShowIcon, ShowinTaskbar, SizeGripStyle, TopMost 69
Events (Olaylar) 69
Action Events 71
Click, MouseClick, DoubleClick, MouseDoubleClick 71
C#_ile_Projeler_ICINDEKILER.indd 9 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERX
Scroll 72
Behavior (Davranış) 72
ControlAdded, ControlRemoved, FormClosed, FormClosing 72
FormLoad, Shown 72
DragDrop 73
DragDrop, DragEnter, DragOver 73
Olay Parametreleri 73
EventArgs 73
Sender 74
Kod Yazım Kuralları 75
Windows Form Application ve Kod Yazmak 76
Proje: Windows Form Application 76
Proje: Form Properties ve Inıtializer 79
Proje: Form Load, Click Olayı ve Properties 88
NameSpace Keywords 95
NameSpace 95
Using ve References 97
IDisposable, Nokta Operatörü, :: İki Nokta Operatörü 98
Access Modifiers (Erişim Belirteçleri) 99
Private (Özel), Public (Genel), Protected (Korumalı), Internal (Dâhili) 99
Protected Internal (Dâhili Korumalı) 99
Assembly 99
Class Hakkında Genel Bilgiler 100
Partial Class, Sealed Class, Abstract Class, Static Class 101
Instance, Inheritance 101
Region 102
Varsayılan Kontrol Olayları 103
Proje: Form ControlAdded ve Remove Olayı 104
Proje: Form MouseClick ve MouseDoubleClick Olayı 112
Proje: Form Closed ve Closing Olayı 117
Proje: Form Shown Olayı 123
Proje: Form DragEnter Olayı 127
C#_ile_Projeler_ICINDEKILER.indd 10 26.12.2013 16:29
İÇİNDEKİLER XI
3 DEĞİŞKENLER, VERİ TİPLERİ VE OPERATÖRLER 133
Variables (Değişkenler), Veri Tipleri 133
Değer Tipleri, Sayısal Veri Tipleri, Sayısal Ondalık Veri Tipleri 134
Karakter Veri Tipi, Mantıksal Veri Tipi, Tarih Veri Tipi 135
Referans Tipleri, Object Veri Tipi 135
String Veri Tipi Bit Hesaplama 135
Var Otomatik Tip Algılayıcısı 136
Proje: Veri Tipleri ve Boyut Hesaplama 136
Değişken Adlandırma Kuralları 144
Değişken Adlandırma Standartları 145
Camel Case, Pascal Case, UpperCase 145
Değişkenlerde Ömür 146
Global Değişkenler, Local Değişkenler 146
Scope (Kapsam) Kavramı 146
Class Scope 146
Block Scope 147
Proje: Global ve Local Değişkenler 147
Bellekteki Yerlerine Göre Değişkenler 151
Stack, Heap 152
Boxing ve Unboxing 152
Operatörler 153
Aritmetik Operatörler, Atama Operatörleri 153
Mantıksal Operatörler, Karşılaştırma Operatörleri 154
Diğer Operatörler ve Semboller, İşlem Önceliği 155
Proje: Operatörler 156
4 TİP DÖNÜŞÜMLERİ VE DEĞİŞKEN TİPLERİNİ ANLAMAK 165
Değişkenlerin Tip Dönüşümleri 165
Casting Yöntemi 166
Implicit (Bilinçsiz) Tür Dönüşümü 166
Explicit (Bilinçli) Dönüşümler 167
Convert Yöntemi 168
C#_ile_Projeler_ICINDEKILER.indd 11 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXII
String Türü Dönüşümler 169
Parse Yöntemi, Döndürdüğü Hatalar: 170
TryParse 170
As İfadesi ile Tip Çevirimi 170
Proje: TipDonusumleri 171
Değişken Tiplerini Anlamak 179
GetType() Değişken Tiplerini Anlamak, TypeOf() veya is Kullanımı 180
Proje: GetType, TypeOf ve is 180
5 MESSAGEBOX SINIFI 185
Mesaj Kutusu 185
Mesaj Kutusu Butonları 187
Mesaj Kutusu İkonları, DıalogResult 190
Proje: Mesaj Kutusu ve DialogResult 190
6 KONTROL DEYİMLERİ 205
If (Eğer) Else (Değilse) 205
If, Else If, Else 205
Swıtch Case 206
Proje: If Else - Switch 207
Ternary 216
Coalescing 216
Proje: Ternary, Coalescing 216
7 DÖNGÜLER 227
Döngüler 227
For Döngüsü 227
Proje: For Döngüsü ve Break 229
Proje: Forma ComboBox eklemek 231
Foreach Döngüsü 234
Proje: Foreach Döngüsü 235
While Döngüsü 239
C#_ile_Projeler_ICINDEKILER.indd 12 26.12.2013 16:29
İÇİNDEKİLER XIII
8 DİZİLER ARRAY 241
Diziler (Array) 241
Proje: Diziler (Array) 242
Collections (Koleksiyonlar) 252
ArrayList Class (Sınıfı) 253
Proje: ArrayList 253
ArrayList Özellikleri ve Metotları 256
Listeye Eleman Eklemek 257
Add Metodu, AddRange Metodu, Insert Metodu, InsertRange 257
Kapasite: Capacity Özelliği, TrimToSize Metodu 257
Eleman Sayısı: Count Özelliği 258
Temizleme/Silme İşlemleri 258
Clear, Remove Metodu , RemoveAt, RemoveRange Metodu 258
Arama İşlemleri 258
Contains Metodu 258
IndexOf Metodu, LastIndexOf Metodu 259
Sıralama 259
Sort, Reverse 259
Tip Çevirimleri 260
ToArray Metodu, ToString Metodu 260
HashTable Sınıfı 265
Proje: HashTable Sınıfı 265
HashTable Özellikleri ve Metotları 269
Listeye Eleman Eklemek 269
Add Metodu 269
Temizleme/Silme İşlemleri 269
Clear Metodu, Remove 269
Kapasite 270
Eleman Sayısı, Count Özelliği 270
Arama İşlemleri 270
Contains Metodu, ContainsKey Metodu, ContainsValue Metodu 270
C#_ile_Projeler_ICINDEKILER.indd 13 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXIV
Tip Çevirimleri 271
ToString Metodu 271
SortedList Sınıfı 272
Proje: SortedList 272
SortedList Özellikleri ve Metotları 275
GetKey Metodu, IndexOfKey 275
IndexOfValue, Queue, Stack 276
Proje: Queue and Stack 276
Collection.Generic (Jenerik Koleksiyonlar) 285
Benzerlik Tablosu 286
Generic List Sınıfı 286
Generic List Özellikleri ve Metotları 286
Listeye Eleman Eklemek 287
Add, AddRange, Insert Metodu, InsertRange Metodu 287
Kapasite 287
Capacity Özelliği 287
TrimExcess Metodu 288
Eleman Sayısı: Count Özelliği 288
Temizleme/Silme İşlemleri 288
Clear, Remove, RemoveAt Metodu, RemoveRange Metodu 288
Arama İşlemleri 289
Contains Metodu, IndexOf Metodu, LastIndexOf Metodu 289
Sıralama 289
Sort, Reverse 289
Tip Çevirimleri 290
ToArray Metodu, ToString Metodu 290
Proje: GenericList 290
Generic Dictionary 296
Generic Sorted List 299
Generic Queue, Generic Stack 300
Tuple 301
Proje: Tuple 301
C#_ile_Projeler_ICINDEKILER.indd 14 26.12.2013 16:29
İÇİNDEKİLER XV
9 DİĞER VERİ TİPLERİ 305
Nullable 305
Nullable Tipler Metot ve Özellikleri: 305
Properties: Value, HasValue 305
Method: GetValueOrDefault 306
Guid 306
Proje: NullableGuıd 306
Struct 309
Enum 309
Proje: Struct ve Enum 310
Enum Metotları 315
GetName, GetNames, GetValues, Parse Metodu 315
10 REGEX CLASS 317
Regex Sınıfı 317
Karakterler 317
Özel Karakterler 318
IsMatch Metodu 318
Mail Adresi Regex 320
Tarih Formatı Regex 321
Sadece Rakam Girişi İçin Regex, Harf ve Rakam Girişi İçin Regex 321
Proje: Regex 321
11 ENVIRONMENT INFORMATION APPLICATION RANDOM TİMER CLASS 327
Environment Class 327
Environment Özellikleri 327
Environment Metotları 328
Proje: Environment Property Method SpecialFolder 328
SystemInformation Class 335
Proje: SystemInformation 335
Application Class 339
Proje: Application Class, Sistemdeki Ondalık Ayracı Bulmak 344
C#_ile_Projeler_ICINDEKILER.indd 15 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXVI
Random Class 344
Kurucu (Constructor) Metodu 344
Random Metotları 344
Next 344
NextBytes, NextDouble 345
Proje: Random 345
Timer Class 350
Timer Kontrolü Özellikleri (Properties) 350
Enabled, Interval 350
Tag 351
Timer Kontrolü Event: Tick 351
Timer Kontrolü Metotları: Dispose, Start, Stop, ToString 351
Proje: Timer Class 352
12 METOTLAR 361
Metotlar 361
Erişim Belirteçleri, Dönüş Değeri, Parametreler, Static Metotlar 362
Değer Döndürmeyen (void) Metotlar 363
Değer Döndüren Metotlar 367
Metotlarda Parametre 367
İsimlendirilmiş Parametreler 368
Proje: Değer Döndüren ve Döndürmeyen Metot Kullanmak 368
Keys 378
Contsructor (Yapıcı Metot), Metotların Aşırı Yüklenmesi (Overloading) 379
Proje: Overloading 380
Olay Metotları 384
Event Handler 385
Proje: Olay Metotları 385
Recursıve Metotlar 391
Proje: Recursive Metot 391
Tarih Biçimlendirme 397
Summary (Metot Açıklamaları) 402
C#_ile_Projeler_ICINDEKILER.indd 16 26.12.2013 16:29
İÇİNDEKİLER XVII
Params (Parametrelere Birden Fazla Değer Göndermek) 402
Proje: Params ve Summary 402
Metotlar ve Class Kavramı 411
Projeye Class Eklemek 411
Proje: Metotlar ve Class Kavramı 411
Metotlarda Out Parametresinin Kullanımı 419
Extension Methods 430
Class Library Projesi Başlatmak 431
Dynamic Link Library Oluşturmak 431
Proje: Extension Metotlar: MyExtension metodu. 433
IsCIft Metodu 434
IsNumerIc Metodu 435
Proje: Bir Projede DynamIc Link Library kullanmak 436
Projelere Referans Eklemek 437
Method Override 441
Proje: Method Override 442
13 STRING VE STRING BUILDER CLASSES, STOPWATCH CLASS 447
String Sınıfı 447
String Class Properties: Char Özelliği, Length Özelliği 448
String Class Methods 448
Kopyalama İşlemleri: Clone, Copy 448
Karşılaştırma: Compare 448
Birleştirme 449
Silme: Remove 451
Değiştirme: Replace 451
Parça Alma: SubString 452
Metin Bölme: Split 452
Ekleme: PadLeft 452
Ekleme: PadRight 453
Kırpma: Trim, TrimStart 453
Kırpma: TrimEnd 454
C#_ile_Projeler_ICINDEKILER.indd 17 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXVIII
Arama 454
Contains, StartsWith, EndWith, IndexOf 454
LastIndexOf 455
IndexOfAny, EndsWith 456
Null Kontrolleri 457
IsNullOrEmpty, IsNullOrWhiteSpace 457
Biçimlendirme: Format 458
Formatlama Belirteçleri 459
Rakamsal Formatlama Listesi, Tarihsel Formatlama Listesi 460
Çevirim İşlemleri 461
Karakterlerine Ayırma, ToCharArray 461
Harf Çevirimleri 462
ToLower, ToUpper, ToTitleCase (CultureInfo Class), ToString 462
Proje: String Class Methods (TcCheck) 463
StringBuilder Sınıfı 480
Proje: StringBuilder 480
StopWatch 482
StringBuilder Properties 483
Capacity, MaxCapacity 483
Length 484
StringBuilder Methods 484
Append, AppendLine, AppendFormat 484
Clear, CopyTo 484
EnsureCapacity 485
Equals 485
Insert, Remove, Replace 486
Proje: StringBuilder Metot ve Özellikleri 486
StopWatch Sınıfı 492
StopWatch Özellikleri, Elapsed, ElapsedMilliseconds 492
IsRunning 492
StopWatch Metotları 492
Reset, Restart, Start, StartNew, Stop 492
C#_ile_Projeler_ICINDEKILER.indd 18 26.12.2013 16:29
İÇİNDEKİLER XIX
14 MATH VE DATETİME CLASSES 493
Math Class 493
Metotları 493
Abs, BigMul, Ceiling, Floor, Log10 493
Max 494
Min, Pow, Round, Sqrt, Truncate 494
DateTime Sınıfı, UTC 496
DateTime Özellikleri 497
Today, Now, UtcNow, Date 497
Day, Month, Year, DayOfWeek, DayOfYear, TimeOfDay 498
Hour, Minute, Second 498
Millisecond 499
Kind 499
Proje: DateTime Properties 499
DateTime Metotları 501
Ekleme İşlemleri 501
Add 501
Proje: DateTimeMethods_Add Metodu 502
AddYears 502
AddMonths, AddDays, AddHours, AddMinutes 503
AddSeconds, AddMilliseconds 503
Tarih Farkını Bulmak: Subtract 503
Karşılaştırma 504
Compare 504
CompareTo, Equals 505
Ayın Son Gününü Bulmak (DaysInMonth) 505
From 505
FromFileTime, FromFileTimeUtc 505
FromOADate, To, ToFileTime, ToFileTimeUtc, ToOADate 506
ToLocalTime, ToUniversalTime 507
ToLongDateString, ToLongTimeString, ToShortDateString 508
C#_ile_Projeler_ICINDEKILER.indd 19 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXX
ToShortTimeString, ToString 508
Is 508
IsDaylightSavingTime, IsLeapYear 508
Parse, Parse, TryParse 509
TimeSpan Struct 510
TimeSpan Properties 511
Days, Hours, Milliseconds, Minutes, Seconds, Ticks, TotalDays 511
TotalHours, TotalSeconds, TotalMinutes, TotalMilliseconds 512
TimeSpan Methods 513
Ekleme, Add 513
Karşılaştırma 513
Compare, Equals, Çıkarma, Subtract 513
From 513
FromDays, FromHours, FromMinutes, FromSeconds 513
FromMilliseconds, FromTıcks 513
İşaretleme: Negate 514
Tip Çevirimleri: Parse, TryParse, ToString 514
15 HATA DENETİMİ 515
Try Catch Finally 515
Exception Class 516
Properties (Özellikler) 516
HelpLink, Message, Source, StackTrace, TargetSite 516
Methods (Metotlar) 517
GetType, ToString 517
Proje: Try Catch Finally 517
Sadece Ondalık Sayıya İzin vermek 520
Other Exceptions Classes 523
ArgumentException, ArgumentNullException 523
DıvıdeByZeroException, FormatException 523
IndexOutOfRangeException, OverflowException, SqlException 524
Throw 524
C#_ile_Projeler_ICINDEKILER.indd 20 26.12.2013 16:29
İÇİNDEKİLER XXI
Proje: Exception 524
Yazım Hataları 535
Parantez Hataları 535
Büyük-Küçük Harf Hataları, Noktalama Hataları 536
RunTime Hataları 538
ErrorProvider 538
Silinen Olay Metotları 539
Olay Metotlarını Resetlemek 540
Olay Metodunu Standart Dışı Adlandırmak 541
Bir Metodu Farklı Adlandırılmış Bir Olaya Bağlamak 541
16 DOSYA VE KLASÖR İŞLEMLERİ (SYSTEM.IO) 545
System.IO Kütüphanesi 545
IO NameSpace Classes 546
Directory Methods 546
Proje: System_IO 546
Klasör Oluşturma İşlemleri 547
CreateDirectory 547
Exception Listesi 547
IOException, UnauthorızedAccessException 547
ArgumentException, ArgumentNullException 548
PathTooLongException, DirectoryNotFoundException 548
NotSupportedException 549
Klasör Silme İşlemleri: Delete 549
Klasörleri Listelemek 550
EnumerateDirectories 550
Klasör Var mı? Exists 551
Get İşlemleri 551
GetCreationTime, GetCreationTimeUTC 551
GetCurrentDirectory, GetDirectories 551
GetDirectoryRoot, GetFiles 552
GetFileSystemEntries, GetLastAccessTime 554
C#_ile_Projeler_ICINDEKILER.indd 21 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXII
GetLastAccessTimeUTC, GetLastWriteTime 555
GetLastWriteTimeUtc, GetLogıcalDrives 555
GetParent 556
Set İşlemleri 556
SetCreationTime, SetCreationTimeUtc, SetCurrentDirectory 557
SetLastAccessTime, SetLastAccessTimeUtc 557
SetLastWriteTime, SetLastWriteTimeUtc 557
Taşıma: Move 557
DirectoryInfo Class 558
DirectoryInfo Özellikleri 558
Klasör Var mı? Exists 558
Klasörün Adı: Name 558
Üst Klasöre Ulaşım: Parent, Kök Dizin, Root 559
Proje: DirectoryInfo Class 559
DirectoryInfo Metotları 561
Klasör Oluşturmak: Create, CreateSubDirectory, Klasör Silmek: Delete 561
Klasör Listelemek 561
EnumerateDirectories 561
EnumerateFiles, EnumerateFileSystemInfos, GetDirectories 562
GetFiles, GetFileSystemInfos 562
Klasör Taşımak: MoveTo 562
ToString 562
Proje: DirectoryInfo Metotları 563
DriveInfo Class 574
Dosya Depolama Kapasiteleri 574
DriveInfo Özellikleri 575
Disk Boyutları: AvailableFreeSpace, TotalFreeSpace, TotalSize 575
Sürücü Format ve Tipleri: DriveFormat, DriveType 575
Disk Hazır mı? IsReady 575
Disk Adı, Etiketi: Name, RootDirectory, VolumeLabel 576
DriveInfo Metotları 576
C#_ile_Projeler_ICINDEKILER.indd 22 26.12.2013 16:29
İÇİNDEKİLER XXIII
Tüm Diskleri Listelemek: GetDrives 576
Proje: DriveInfo Class 576
Path Class 581
Path Parametresi Klasör mü? 584
Dosya Uzantısını Değiştirmek: ChangeExtension 584
Klasör Yol Bilgisini Kombine Etmek: Combine 584
Get İşlemleri 585
GetDirectoryName, GetExtension, GetFileName 585
GetFileNameWithoutExtension, GetFullPath 585
GetInValidFileNameChars, GetInValidPathChars, GetPathRoot 586
GetRandomFileName, GetTempFileName, GetTempPath 586
Dosyanın Uzantısı Var mı? HasExtension 586
Klasörde Bir Kök Dizin Var mı? IsPathRooted 587
File Class 587
File Class Metotları 588
Dosyaya Metin Ekleme İşlemleri 588
UTF-8 Nedir? 588
AppendAllLines 588
AppendAllText, AppendText, WriteAllBytes, WriteAllLines 589
Okuma İşlemleri 589
ReadAllBytes, ReadAllLines, ReadAllText, ReadLines 590
Dosya Oluşturma İşlemleri: Create, CreateText 590
Dosya Kopyalama: Copy 590
Dosya Taşıma: Move 590
Dosyanın Silinmesi: Delete 590
Değiştirme İşlemleri: Replace 590
Şifreleme İşlemleri: Encrypt, Decrypt 591
Dosya Açmak: Open, OpenRead, OpenWrite, OpenText 591
Dosya var mı? Exists 591
Get İşlemleri 591
GetAccessControl 591
C#_ile_Projeler_ICINDEKILER.indd 23 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXIV
GetAttributes, GetCreationTime, GetCreationTimeUtc 592
GetLastAccessTime, GetLastAccessTimeUtc 592
GetLastWriteTime, GetLastWriteTimeUtc 592
Set İşlemleri 592
SetAccessControl, SetAttributes, SetCreationTime 592
SetLastAccessTime, SetLastAccessTimeUtc, SetLastWriteTime 593
SetLastWriteTimeUtc 593
Proje: File Class - NoteWriteReadPrograming 593
FileInfo Class 604
FileInfo Properties 604
Directory, DirectoryName, Name, Exists, IsReadOnly 605
Length 606
FileSystemInfo Class 606
Özellikler 606
Attributes 606
CreationTime, Extension, FullName, Name 607
LastAccessTime, LastWriteTime 607
Metotlar: Delete 608
MemoryStream Class: Özellikleri 608
CanRead, CanSeek, CanWrite, Capacity, Length 608
Position 609
StreamReader Class 610
StreamReader Özellikleri: CurrentEncoding, EndOfStream 610
StreamReader Metotları: Close, Read, ReadLine, Peek 610
StreamWriter 610
StreamWriter Özellikleri: Encoding, AutoFlush 610
StreamWriter Metotları 610
Close 610
Write, WriteLine 611
Proje: NotePadLike 611
FileSystemWatcher 622
C#_ile_Projeler_ICINDEKILER.indd 24 26.12.2013 16:29
İÇİNDEKİLER XXV
FileSystemWatcher Özellikleri 622
EnableRaisingEvents, Filter, IncludeSubDirectories 622
NotifyFilter, Path 623
Olayları: Changed, Created, Deleted, Renamed 623
Proje: Klasör Değişikliklerini Takip Etmek 623
WriteLineAsync (Asenkron) 627
17 XML 629
XML 629
Proje: XML Sample - ReadXML 630
Root Element 630
Node Element, Child Element, XML Element, Inner Text 631
DataSet ReadXml Metodu 633
Excel Programı ve XML 634
Proje: XML Sample - XMLDocument 634
Proje: TCMB Kur Çek 638
DataSet Sınıfı ve XML 646
Proje: Haber Siteleri ve RSS 649
18 THREAD 655
Thread 655
Proje: ThreadSample 659
19 SQL SERVER 663
Veritabanı, SQL Sorgulama Dili, SQL Server 663
SQL Server 2012 Kurulumundaki Önemli Noktalar 664
SQL Server Instance: Default Instance, Named Instance 665
Server Configuration, Collation Sekmesi (Dil Seçenekleri) 665
Database Engine Configuration, Server Configuration Sekmesi 666
Authentication Mode: Windows Authentication, Mixed Mode 666
Data Directories 667
Data, Temp ve Backup Verileri Ayrı Disklerde Olsun 668
C#_ile_Projeler_ICINDEKILER.indd 25 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXVI
SQL Server Managament Studio 669
Northwind Veritabanı 669
Sistem Veritabanlarının Görevleri 670
Normalizasyon Kuralları 671
Tablolarda İlişkiler 672
Primary Key 672
Unique Özelliği 673
Unique ve Primary Key Benzerliği 673
Foreign Key 673
Diğer Kısıtlayıcılar 673
Check Constraint 673
Unique Constraint, Default Constraint 674
İlişkisel Veritabanı 674
Sorgu Nereye Yazılır? 678
USE, GO, Print 680
Sorgu Yazmak: Select Sorgusu 680
Sorgu Yazarken Dikkat Etmeniz Gerekenler 681
Sorgu Sonucunu Excel Programına Kopyalamak 682
Sorguda Koşul(Where), Between 682
Koşulda Bir İşlem Sonucunu Kullanmak 683
Distinct (Sorguda Sütun Tekrarlarının Önüne Geçmek) 684
AND 685
OR 686
IN 687
Like, Özel Karakterler 688
Space 690
Null, Is Null Operatorü 691
IsNull Function, Order By 692
Top 693
With Ties 694
Replicate (Veri Tekrarla) 695
C#_ile_Projeler_ICINDEKILER.indd 26 26.12.2013 16:29
İÇİNDEKİLER XXVII
Tip Çevirim İşlemleri 695
Convert 695
Tarih Tipi Çevirimleri 697
Cast 698
Transact-SQL 699
DML 699
Select, Update, Insert, Delete 699
DDL 699
Create Table 699
Alter Table, Drop Table, Create Index 700
DCL 700
SQL Server Fonksiyonları 700
Date Functions 700
DateDiff, GetDate 700
DatePart 701
DateAdd: Bir Ay Sonrasını Bulmak, Ay Sonunu Bulmak 703
DateName, Day, Month, Year 704
DateFromParts, DateTimeFromParts, SmallDateTimeFromParts 705
TimeFromParts, SysDateTime, GetUtcDate 705
Eomonth (Ay Sonu), Conver 706
Tarih Formatını Geçici Olarak Değiştirmek 706
Aggregate Functions (Toplam Fonksiyonları) 706
Avg, Count, Sum, Max-Min 708
Scalar Functions 708
Upper, Lower 708
SubString 709
Len, Round 710
Ascii, Char 710
CharIndex, Left-Right 711
RTrim-LTrim, Replace 711
Reverse, Format, Group By 712
C#_ile_Projeler_ICINDEKILER.indd 27 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXVIII
Having 714
Koşul Kontrolleri 716
Case 716
IIf 720
Set Statement 720
DateFirst, DateFormat 720
Concat_Null_Yields_Null, IdentityInsert 721
Language 722
Join 722
Inner Join 722
Left Join, Right Join, Outer Join, Full Join, Bir Tabloya Veri Eklemek 723
InnerJoin Örneği 725
Left Join Örneği 726
Right Join Örneği 727
Edit Modunda Sorgu Yazmak 728
Full Join Örneği 729
Değişken Kullanımı 734
Nokta Virgül Ayarları ve Replace Fonksiyonu 734
Information_SCHEMA 735
Veritabanı Tablolarını Listelemek 735
Bir Sorguda Farklı Veritabanlarında İşlem Yapmak 736
Veritabanı Sütunlarını Listelemek 737
Check Constraint Bilgisi, Table Constraint Bilgisi 737
Prosedür ve Fonksiyon Parametrelerini Listelemek 737
Prosedür ve Fonksiyon Scripts Listelemek 737
View ve Scripts Listelemek 737
View Başvuru Tablosu Listesi 738
Constraint 738
Primary Key Constraint, Foreign Key Constraint, Unique Constraint 738
Default Constraint, Check Constraint 739
Çeşitli SQL Server Sorgu Örnekleri 741
C#_ile_Projeler_ICINDEKILER.indd 28 26.12.2013 16:29
İÇİNDEKİLER XXIX
Kullanılan Dil Yapısı, User Name, Kullanıcı Rolleri, Diyagram Listesi 741
Veritabanı Dosya Yolunu Bulmak 741
Identity Column and Increment 743
Identıty Column ID Değerini Resetlemek 745
Son Identity Değerini Bulmak 745
@@Identity 745
Scope_Identity, Ident_Current 746
Sorgularda Sıra Numarası-Row_Number 747
Sıra Numarasını Gruplamak-Dense_Rank 747
Design Modu 748
Prevent Saving Changes (Değişikliklerim Geçerli Olmuyor) 749
Refresh 750
DML 750
INSERT 750
Sütun Belirtmeden Insert Sorgusu Yazmak 753
Aynı Anda Birden Fazla Veri Insert Etmek 753
Tablodaki Verilerin Yedeğini Almak 754
BULK INSERT 755
UPDATE 756
DELETE 757
TRUNCATE 758
Tekrar Eden Verileri Silmek 758
Query Designer 765
Diagram 765
Criteria, SQL Sorgusu 766
Change Type (Sorgu Tipini Değiştirmek) 770
Insert Values 771
Update 772
Delete 773
Sorguları Gruplamak 774
SQL Profiler-Profiler Özelleştirmesi 775
C#_ile_Projeler_ICINDEKILER.indd 29 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXX
SQL Server Instance 776
SQL Server Snippets 778
Setting Import - Export 779
General Settings: Customize, Options, Environment 780
New Query Hazır Gelsin 780
Designers (Tablodaki Değişiklikler Kabul Edilsin) 781
Object Explorer 781
Select Top 1000 Rows Değişsin 781
Text Editor: 782
Satır Numarası, Satıra Sığmayan Verinin Alt Satıra İnmesi, Tab 782
Setting Export 783
View 784
Create 784
Alter, View Order By 785
Top 786
Sub Query 786
View Konumu 787
With Check Option ile View Kontrolü 788
Şifreleme, With Schemabinding 790
Table Design 791
Northwind For Views 793
Tables For DDL 795
Create Table, Alter Table, Drop Table 795
Create Index, Constraints (Kısıtlayıcılar) 796
Object Explorer ile Tablo Oluşturmak, Veri Tipleri 808
Script Kullanmak 810
Union Operatörü, Union All Operatörü 816
Yürüyen Bakiye 820
RowNumber, DenseRank ve Over 823
Stored Procedure 824
Parametrelerde Like Kullanımı 825
C#_ile_Projeler_ICINDEKILER.indd 30 26.12.2013 16:29
İÇİNDEKİLER XXXI
Procedure ile Değer Döndürmek 826
Employees Tablosuna Yeni Bir Personel Ekleyen Prosedür 826
Yeni Bir Kategori Ekleyen Prosedür 828
Ürün Miktarı ve Fiyatını Ekleyen Prosedür 829
Ürün ve Kategorisini Ekleyen Prosedür 831
Identity Sütunu Resetleyen Prosedür 832
Identity Sütunu Bulmak 834
Prosedürlerin Konumu 835
Ürünü ve Kategorisini Silen Prosedür 836
Functions 839
KDV Fonksiyonu 840
Fonksiyonların Konumu 840
İki Tarih Arasındaki Farkı Bulan Fonksiyon 841
Ayın Son Gününü Döndüren Fonksiyon 841
Tarihleri Türkiye formatında gösteren Fonksiyon 842
Ay Adını Döndüren Fonksiyon 843
Tablo Döndüren Fonksiyon 843
Trigger 844
After Trigger, Instead Of 845
Kategoriler Tablomdan Veri Silinemesin, Güncellenemesin 846
Kategoriler Tabloma Veri Eklenemesin 846
After Insert-Update-Delete 847
Disable Trigger 848
Güncellenen Verinin Önceki Hali ve Sona Hali 848
Shippers Tablosundan Silinen Veriyi Yedeklemek 849
Trigger Konumu 851
Koşullu Çalışan Trigger ve Rollback 851
Transaction 851
Güncellemeyi Geri Sarmak, Transaction ve Rollback 852
Her Sorgu (Update/Delete/Insert/Drop) Öncesi Transaction 853
Transaction Bankamatik 854
C#_ile_Projeler_ICINDEKILER.indd 31 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXXII
Açık Kalan Transacitons ve Zararları 863
Clustered Index 864
Backup 866
Full Backup, Differential (Fark) Backup 866
Transaction Log Backup, Backup İşlemi 867
Restore İşlemi 869
Veritabanına Kimler Bağlı 870
Connection (Bağlantı) Info, Session (Oturum) Info 870
Bağlı Kullanıcıların Bağlantılarını Kesmek 871
Backup Restore Sample 872
Backup Sample, Sorgu ile Backup 873
Geri Yükleme Simulasyonu, Restore Sample 875
Options Sekmesi 876
Zamana Göre Restore, Yedek Dosyası Raporu 879
Log Backup Geri Yükleme İşlemi, Restoring Mode 884
Backupset 884
Script İşlemleri 885
Otomatik Script Oluşturma 885
Script İle Backup (Yedekleme) 887
Veritabanı MDF ve LDF Dosyalarına Ulaşmak, MDF Kopyalama 890
Full Text Search 894
Katalog 895
Indeks 897
İçerik 899
Full Text Search Kullanımı 900
Contains 900
Full Text 901
Agent 901
General, Steps 902
Schedules 903
Maintenance Plans ve Backup 904
C#_ile_Projeler_ICINDEKILER.indd 32 26.12.2013 16:29
İÇİNDEKİLER XXXIII
Shrink Databases ayarları 907
Differential Backup için ayarları 908
SQL Server Logins: 912
SQL Server Authentication Kullanıcısı Eklemek 912
Windows Authentication Kullanıcısı Eklemek 914
Excel Programına Veri Göndermek 916
Choose a Data Source 916
Choose a Destination 917
Select Source Tables and Views 918
Review Data Type Mapping, Save and Run Package 919
Excel Programından Veri Almak 920
Choose a Data Source 921
Choose a Destination 921
Select Source Tables and Views 922
Review Data Type Mapping 922
Save and Run Package 923
20 OBJECT ORIENTED PROGRAMING 925
Nesne Yönelimli Programlama 925
Abstraction, Inheritance, Polymorphism, Encapsulation 925
Class Bileşenleri 926
Methods, Fields, Properties, Constructors, Events, Delegates 926
Proje: Object Oriented Programıng Kisi Class 927
Proje: OOP Bisiklet Montaj 934
Proje: OOP Araç Galerisi 940
ListBox Kontrolünde Delete Tuşu ile Veri Silmek 957
Resim Yükleme İşlemi 957
Resmi Sürükle Bırak Yöntemi ile Yüklemek 958
Architecture 958
Show On Code Map 960
Proje: DragDrop 962
Class Library ve Inheritance 967
C#_ile_Projeler_ICINDEKILER.indd 33 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXXIV
User Control 970
Referans Yüklemek 971
Proje: MineTextBox - ClassLibrary - Class. 972
Miras Alma İşlemi (Inheritance) 975
DLL Kütüphanesinin Kullanımı 979
Proje: User Control Kullanmak 979
21 RUNTİME CONTROLS 983
RunTime Controls Add 983
Proje: Runtime Controls / Seyahat İşletmesi 983
22 RESİM İŞLEMLERİ 999
Resim Galerisi 999
Mac Ronalds - Hamburgerci 1012
Resource Yöntemi ile Resim Yüklemek 1012
Disk Klasör ve Dosya Listeleyici 1022
StatusStrip Kontrolü 1023
QRCode-Kare Kod 1037
Çoklu Form Çalışmaları 1045
Aynı Proje İçerisinden Erişim 1045
Farklı Projeden Erişim 1049
23 ACTIVEX DATA OBJECT .NET 1053
Activex Data Object .NET 1053
Connected Mimari 1053
Connected Mimaride Kullanılan Sınıflar 1053
SQLConnection 1053
SQLCommand, SQLDataReader 1054
Disconnected Mimari 1054
Disconnected Mimaride Kullanılan Sınıflar 1054
SQLConnection 1054
SqlDataAdapter 1054
C#_ile_Projeler_ICINDEKILER.indd 34 26.12.2013 16:29
İÇİNDEKİLER XXXV
SqlDataSet 1055
Proje: Activex Data Object Connected Mimari 1056
Actıvex Data Object ve SQL Server Profiler 1058
Connected Mimari ve Data Reader 1060
Proje: DataReader 1060
Active Directory ve ADO .NET Bağlantısı 1064
SQL Command Metotları 1064
ExecuteNonQuery, ExecuteReader 1064
CommandBehavior Enum Listesi, CloseConnection, SingleRow 1065
ExecuteSclar 1065
Proje: Disconnected Mimari 1065
ADO Bağlantı Cümleleri 1068
Enabling Multiple Active Result Sets 1069
Stored Procedure ve SqlCommand 1070
Proje: SQL Server Prosedürü Kullanmak 1073
Bir Projeyi Referans Olarak Kullanmak 1106
Data Table ve DataBinding 1126
Proje: Binding Context 1126
24 CLASSES VE ADO.NET 1135
Classes ve ADO.NET 1135
Proje: NorthwindForClasses 1136
Entity Class Library 1137
Excel ile Class Hazırlamak 1140
Tool Class Library 1142
Facade Class Library 1144
DataReader Null Kontrolü 1148
DataGridView Kontrolünde Arama 1155
25 ENTITY FRAMEWORK VE LINQ 1163
Proje: Entity Data Model ve Linq 1164
ADO.NET Entity Data Model 1165
C#_ile_Projeler_ICINDEKILER.indd 35 26.12.2013 16:29
PROJELER İLE C# VE SQL SERVERXXXVI
Entity Data Model Wizard, Choose Model Contents 1165
Choose Your Data Connection 1166
Choose Your Database Objects and Settings 1167
DataTable Load Metodu ve DataReader 1172
Linq ve Lambda Expression 1176
Proje: Linq ve Lambda Expression 1176
SelectionChangeCommitted 1180
Linq ve Lambda Expression Join 1183
DataGridView Satır Numaralandırma 1183
Proje: Linq ve Lambda Join 1185
Proje: Empty Model 1190
CRUD Class 1203
Kontrollerin Tag Özellikleri 1218
Application Sınıfı OpenForms Özelliği 1224
Açık Formlara Erişim 1224
Projeleriniz için Tavsiyeler 1225
C#_ile_Projeler_ICINDEKILER.indd 36 26.12.2013 16:29