15 Kasım 2018 Perşembe

C# process sonlandırmayı bekle cmd execute çalıştır komut

const string ex1 = "C:\\";
        const string ex2 = "C:\\Dir";

        // Use ProcessStartInfo class.
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.CreateNoWindow = false;
        startInfo.UseShellExecute = false;
        startInfo.FileName = "dcm2jpg.exe";
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;
        startInfo.Arguments = "-f j -o \"" + ex1 + "\" -z 1.0 -s y " + ex2;

        try
        {
            // Start the process with the info we specified.
            // Call WaitForExit and then the using-statement will close.
            using (Process exeProcess = Process.Start(startInfo))
            {
                exeProcess.WaitForExit();
            }
        }
        catch
        {
            // Log error.
        }

31 Ekim 2018 Çarşamba

c# random kullanımı next vs

Random rnd=new Random();
Buradaki yarattığımız nesnenin adı rnd. Şimdi bu nesne üzerinden Random sınıfının metotlarına erişebileceğiz.
 int RastgeleSayi1=rnd.Next(10,20);
 int RastgeleSayi2=rnd.Next(50);
 int RastgeleSayi3=rnd.Next();
 double RastgeleSayi4=rnd.NextDouble();
Birinci örnekte: 10 ile 20 arasında int türden rastgele bir sayı üretilir, 10 dâhil ancak 20 dâhil değildir.
İkinci örnekte: 0 ile 50 arasında int türden rastgele bir sayı üretilir, 0 dâhil ancak 50 dâhil değildir.
Üçüncü örnekte: int türden pozitif herhangi bir sayı üretilir.
Dördüncü örnekte: double türden 0.0 ile 1 arasında rastgele bir sayı üretilir.

25 Ekim 2018 Perşembe

c# image download

You may use the following method to retrieve the image from a specific URL on the web. The below C# function takes an image url, download the image from the url as a stream.

 [insert_adsense]