1 / 9

METODLAR

METODLAR. www.onbirc.com/337/. Metodların Kullanılma Nedeni Metod Bir Metodun Yapısı Parametre Kullanımı. METODLARIN KULLANILMA NEDENİ. Bilgisayar programlarının en büyük avantajı, kullanıcının işini kolaylaştırmalarıdır. Her bilgisayar programı bunu değişik metotlar kullanarak sağlar.

Download Presentation

METODLAR

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. METODLAR www.onbirc.com/337/

  2. Metodların Kullanılma Nedeni Metod Bir Metodun Yapısı Parametre Kullanımı

  3. METODLARIN KULLANILMA NEDENİ Bilgisayar programlarının en büyük avantajı, kullanıcının işini kolaylaştırmalarıdır. Her bilgisayar programı bunu değişik metotlar kullanarak sağlar.

  4. METOD • C# içerisinde küçük bir program birkaç sınıftan ve bu sınıflar ise değişik metotlardan oluşmaktadır. Dolayısı ile metotlar sınıf içerisinde değişik işler yaptırmak için kullandığımız küçük kod parçacıklarıdır. • Belli bir ad altında bir araya getirilmiş C# deyimlerine metoddenir.

  5. Metot kodu { } içinde yazılır. Bir satır deyim bile olsa metot kodu { } içinde yazılır. • Metotların kullanımında diğer bir konu da parametrelerdir. Parametreleri metod adından sonra parantez içinde belirtilirler. • OrnekMetot();

  6. BİR METODUN YAPISI Bir metodun adı tıpkı bir değişken adı gibi adlandırılır. Bu arada metod adları küçük/büyük harf duyarlıdır (case sensitive). Bu anlamda aynı sınıf içinde ornek ve ORNEK adlı iki metod kullanılabilir.

  7. PARAMETRE KULLANIMI Parametreler metoda bilgi geçirilmesini ve metoddan bilgi alınmasın sağlar. Bir metot tanımlandığında parantez içinde parametre listesine yer verilir.

  8. Yapısı: staticvoidOrnekMetot (int deger1, string deger2) { // kod } Örnek: staticvoid Topla(int deger1, int deger2) { return a + b; } staticvoid Main( ) { Console.WriteLine(Topla(5,10)) }

  9. hazırlayan BÜŞRA AŞKIN 11-C 337 www.onbirc.com/337/

More Related