3 Kasım 2014 Pazartesi

Bolum 02 - Degisken Olusturma (Video)



Değişken Türleri
byte  1 bayt 0, ..., 255 (tam sayı)  byte a=5;
sbyte 1 bayt -128, ..., 127 (tam sayı)  sbyte a=5;
short 2 bayt -32768, ..., 32767 (tam sayı)  short a=5;
ushort 2 bayt 0, ..., 65535 (tam sayı)  ushort a=5;
int 4 bayt -2147483648, ..., 2147483647 (tam sayı)  int a=5;
uint  4 bayt 0, ..., 4294967295 (tam sayı)  uint a=5;
long  8 bayt -9223372036854775808, ..., 9223372036854775807 (tam sayı)  long a=5;
ulong 8 bayt 0, ..., 18446744073709551615 (tam sayı)  ulong a=5;
float  4 bayt ±1.5*10-45, ..., ±3.4*1038 (reel sayı)  float a=5F; veya float a=5f;
double 8 bayt ±5.0*10-324, ..., ±1.7*10308 (reel sayı)  double a=5; veya double a=5d; veya double a=5D;
decimal 16 bayt ±1.5*10-28, ..., ±7.9*1028 (reel sayı)  decimal a=5M; veya decimal a=5m;

bool true yada false değer alır.
char 2 bayt Tek bir karakteri tutar. char a='h';
string Sınırsız Metin tutar. string a="Ben bir zaman kaybıyım, beni boşver hocam";

Kaynak:http://tr.wikibooks.org/wiki/C_Sharp_Programlama_Dili/De%C4%9Fi%C5%9Fkenler#De.C4.9Fi.C5.9Fken_t.C3.BCrleri

Bolum 01 - Ilk Program (Video)




2 Kasım 2014 Pazar

03. Text Dosyasına Veri Yazan Sınıfı Kullanmak

Exported from Notepad++
using DosyayaYazdirmaLib; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace txtYaziYazdirma { class Program { static void Main(string[] args) { DosyayaYaz yaz = new DosyayaYaz(); yaz.Yol = "D:\\abc.txt"; yaz.Mesaj = "deneme"; yaz.MesajYaz(); Console.ReadKey(); } } }

02. Text Dosyasına Veri Yazan Sınıf

Exported from Notepad++
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading.Tasks; namespace DosyayaYazdirmaLib { public class DosyayaYaz { string yol; public string Yol { get { return yol; } set { yol = value; } } string mesaj; public string Mesaj { get { return mesaj; } set { mesaj = value; } } public FileMode DosyaModu() { return File.Exists(this.Yol) ? FileMode.Append : FileMode.OpenOrCreate; //deger ? doğruysa : yanlışsa ; } public void MesajYaz() { FileStream yer = new FileStream(this.Yol, DosyaModu()); StreamWriter yazacak = new StreamWriter(yer); yazacak.WriteLine(this.Mesaj); yer.Flush(); yazacak.Close(); yer.Close(); Console.WriteLine(this.Yol+"\n\n"+this.Mesaj +"\n\nKayıt tamamlandı."); } } }