﻿
{"id":541,"date":"2012-04-28T10:21:52","date_gmt":"2012-04-28T10:21:52","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=541"},"modified":"2012-05-18T09:28:53","modified_gmt":"2012-05-18T09:28:53","slug":"cta-fileinfo-sinifi","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/cta-fileinfo-sinifi\/","title":{"rendered":"FileInfo S\u0131n\u0131f\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Dosya hakk\u0131nda bilgi almak ve gerekirse o bilgileri g\u00fcncellemek i\u00e7in FileInfo s\u0131n\u0131f\u0131 kullan\u0131l\u0131r.FileInfo s\u0131n\u0131f\u0131n\u0131 kullanabilmek i\u00e7in <em><span style=\"color: #ff9900;\">System.IO<\/span><\/em> namespaceini projemize eklemeliyiz.<br \/>\n<!--more--><br \/>\nTeker teker \u00f6zelliklerine de\u011finip a\u00e7\u0131klamaktansa, Form \u00fczerine yerle\u015ftirdi\u011fim bir ListBox nesnesine, herhangi bir dosyan\u0131n b\u00fct\u00fcn bilgilerini, gerekli metodlarla yazd\u0131raca\u011f\u0131m.<br \/>\nDedi\u011fim gibi formumuza bir tane ListBox nesnesi yerle\u015ftirdikten sonra a\u015fa\u011f\u0131daki kodlar\u0131 inceleyiniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n private void Form1_Load(object sender, EventArgs e)\r\n        {\r\n            FileInfo Dosya = new FileInfo(&quot;C:\\\\Dosya\\\\Gencay.txt&quot;);\r\n            listBox1.Items.Add(&quot;Dosya var m\u0131? : &quot; + Dosya.Exists);\r\n            \/\/Exists \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n var olup olmad\u0131\u011f\u0131 kontrol edilir.E\u011fer varsa True,yoksa False d\u00f6necektir.\r\n            listBox1.Items.Add(&quot;Olu\u015fturulma tarihi : &quot; + Dosya.CreationTime);\r\n            \/\/CreationTime \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n olu\u015fturulma tarihini elde edebiliriz.\r\n            listBox1.Items.Add(&quot;Son yazma tarihi : &quot; + Dosya.LastWriteTime);\r\n            \/\/LastWriteTime \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n son yazma tarihini elde edebiliriz.\r\n            listBox1.Items.Add(&quot;Dosyan\u0131n tam yolu : &quot; + Dosya.FullName );\r\n            \/\/FullName \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n tam yoluna ula\u015fabiliriz.\r\n            listBox1.Items.Add(&quot;Bulundu\u011fu klas\u00f6r : &quot; + Dosya.DirectoryName);\r\n            \/\/DirectoryName \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n bulundu\u011fu klas\u00f6r\u00fc elde edebiliriz.\r\n            listBox1.Items.Add(&quot;Dosya uzant\u0131s\u0131 : &quot; + Dosya.Extension);\r\n            \/\/Extension \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n uzant\u0131s\u0131n\u0131 \u00f6\u011frenebiliriz.\r\n            listBox1.Items.Add(&quot;Dosya boyutu : &quot; + Dosya.Length);\r\n            \/\/Length \u00f6zelli\u011fi ile FileInfo nesnesine yolu verilen dosyan\u0131n boyutunu \u00f6\u011frenebiliriz.\r\n        }\r\n<\/pre>\n<p>Yukardaki kodlar\u0131n ekran g\u00f6r\u00fcnt\u00fcs\u00fc a\u015fa\u011f\u0131daki gibidir.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2012\/04\/fileinfo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-542\" title=\"fileinfo\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2012\/04\/fileinfo.png\" alt=\"\" width=\"260\" height=\"161\" \/><\/a><\/p>\n<p>Sonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00c7al\u0131\u015fmalar \ud83d\ude42<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Dosya hakk\u0131nda bilgi almak ve gerekirse o bilgileri g\u00fcncellemek i\u00e7in FileInfo s\u0131n\u0131f\u0131 kullan\u0131l\u0131r.FileInfo s\u0131n\u0131f\u0131n\u0131 kullanabilmek i\u00e7in System.IO namespaceini projemize eklemeliyiz.<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12],"tags":[220],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-c-sharp-c","tag-fileinfo"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}