MVC Web Helpers Chart
Çarşamba, 27 Tem 2016
yorum yok
@{ var cacheItemKey = "CachedTime"; var cacheHit = true; var time = WebCache.Get(cacheItemKey); if (time == null) { cacheHit = false; } if (cacheHit == false) { time = @DateTime.Now; WebCache.Set(cacheItemKey, time, 1, false); } } <!DOCTYPE html> <html> <head> <title>WebCache Helper Sample</title> </head> <body> <div> @if (cacheHit) { @:Found the time data in the cache. } else { @:Did not find the time data in the cache. } </div> <div> This page was cached at @time. </div> </body> </html>
Bir fonksiyon şu şekilde tanımlanır.
Function FonksiyonAdı (GirişParametreleri:Tipi):FonkTipi; var sabit,değişken,tiptanımı begin Program Komutları; FonksiyonAdı:=deger; End;
Procedure tanımından farklı olarak fonksiyon geriye bir değer göndereceği için bu değerin tipi fonksiyon tanımından sonra FonkTipi parametresi ile belirlenir. Ayrıca geri dönecek değer fonksiyon adına yada Result ifadesine atanan değer ile yapılır.
Birinci yol;
Function FonksiyonAdı (GirişPArametreleri:Tipi):FonkTipi; var sabit,değişken,tip tanımı begin Program Komutları; Result:=Deger; End;
İkinci yol;
Function FonksiyonAdı (GirişPArametreleri:Tipi):FonkTipi; var sabit,değişken,tip tanımı begin Program Komutları; FonksiyonAdı:=Deger; End;