„Sznikák példakódok” változatai közötti eltérés

a Kód javítása
a ConsoleColor nevű osztályt nem találja a VS-2017, helyette Color lett.
 
(6 közbenső módosítás, amit egy másik szerkesztő végzett, nincs mutatva)
10. sor: 10. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  class ThreadTestClass
  class ThreadTestClass
  {  
  {  
37. sor: 38. sor:
     }  
     }  
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
49. sor: 50. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  SqlConnection conn = null;  
  SqlConnection conn = null;  
  try  
  try  
  {  
  {  
     // Kapcsolódás azadatbázishoz  
     // Kapcsolódás azadatbázishoz  
     conn = new SqlConnection(@"Data Source=LAPTOP\SQLEXPRESS;InitialCatalog=Northwind;Integrated Security=True");  
     conn = new SqlConnection(@"Data Source=LAPTOP\SQLEXPRESS;
          InitialCatalog=Northwind;Integrated Security=True");  
     // A kapcsolat megnyitása  
     // A kapcsolat megnyitása  
     conn.Open();  
     conn.Open();  
83. sor: 86. sor:
       conn.Close();  
       conn.Close();  
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
95. sor: 98. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class MainForm : Form
  public partial class MainForm : Form
  {
  {
115. sor: 119. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
127. sor: 131. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class Form1 : Form
  public partial class Form1 : Form
  {
  {
     private Brush brush1;
     private Brush brush;
     private int grey = 200;
     private int grey = 200;
   
   
141. sor: 146. sor:
       base.OnKeyDown(e);
       base.OnKeyDown(e);
       if(e.KeyCode == Keys.R) {
       if(e.KeyCode == Keys.R) {
          grey -= 10;
           if(grey == 0) // ha elértük a színtartomány végét
           if(grey == 0) // ha elértük a színtartomány végét
             grey = 200;
             grey = 200;
          grey -= 10;
           Invalidate();
           Invalidate();
       }
       }
151. sor: 156. sor:
     {
     {
       base.OnPaint(e);
       base.OnPaint(e);
       using (brush1 = new SolidBrush(ConsoleColor.FromArgb(grey, grey, grey)))
       using (brush = new SolidBrush(Color.FromArgb(grey, grey, grey)))
       {
       {
           e.Graphics.FillRectrangle(brush1, 10, 20, 10, 10);  // brush, x, y, width, height
           e.Graphics.FillRectrangle(brush, 10, 20, 10, 10);  // brush, x, y, width, height
       }
       }
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
169. sor: 174. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class Form1 : Form
  public partial class Form1 : Form
  {
  {
202. sor: 208. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
209. sor: 215. sor:
| keretszín = black
| keretszín = black
| tartalom =
| tartalom =
Írjon programot, ami egy háttérszálban egy perc alatt aszámol 1-zől 60-ig és az aktuális értéket kiírja a konzolra
Írjon programot, ami egy háttérszálban egy perc alatt el számol 1-től 60-ig, és az aktuális értéket kiírja a konzolra.
{{Infobox-táblázat|
{{Infobox-táblázat|
{{Infobox-táblázatsor|A kód nyelve|C#}}
{{Infobox-táblázatsor|A kód nyelve|C#}}
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public class Program
  public class Program
  {
  {
234. sor: 241. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
246. sor: 253. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public class Singleton
  public class Singleton
  {
  {
264. sor: 272. sor:
     public void Print() {/* ... */}
     public void Print() {/* ... */}
  }
  }
</syntaxhighlight>


<syntaxhighlight lang="csharp">
  // Használata:
  // Használata:
  Singleton s1 = Singleton.Instance;
  Singleton s1 = Singleton.Instance;
270. sor: 280. sor:
  // Vagy:
  // Vagy:
  Singleton.Instance.Print();
  Singleton.Instance.Print();
 
</syntaxhighlight>


{{Infobox
{{Infobox
282. sor: 292. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  class SelectIntoDataSet{
  class SelectIntoDataSet{
     public static void Main(){
     public static void Main(){
312. sor: 323. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
324. sor: 335. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  [AttributeUsage(AttributeTargets.All)]
  [AttributeUsage(AttributeTargets.All)]
  public class AuthorAttribute : System.Attribute
  public class AuthorAttribute : System.Attribute
342. sor: 354. sor:
     }
     }
  }
  }
</syntaxhighlight>


<syntaxhighlight lang="csharp">
  // Használata
  // Használata
  [Author("Béla Béla")]
  [Author("Béla Béla")]
349. sor: 363. sor:
  // ...
  // ...
  }
  }
</syntaxhighlight>


<syntaxhighlight lang="csharp">
  // Lekérdezés
  // Lekérdezés
  foreach( object attribute in something.GetCustomAttributes(true))
  foreach( object attribute in something.GetCustomAttributes(true))
355. sor: 371. sor:
     Console.WriteLine(attribute);
     Console.WriteLine(attribute);
  }
  }
</syntaxhighlight>


   
   
   
   


[[Kategória:Infoalap]]
[[Kategória:Mérnök_informatikus]]
A lap eredeti címe: „https://vik.wiki/Sznikák_példakódok