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

Nincs szerkesztési összefoglaló
Nincs szerkesztési összefoglaló
10. sor: 10. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp" line start="1">
<syntaxhighlight lang="csharp">
  class ThreadTestClass
  class ThreadTestClass
  {  
  {  
50. sor: 50. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  SqlConnection conn = null;  
  SqlConnection conn = null;  
  try  
  try  
84. sor: 85. sor:
       conn.Close();  
       conn.Close();  
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
96. sor: 97. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class MainForm : Form
  public partial class MainForm : Form
  {
  {
116. sor: 118. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
128. sor: 130. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class Form1 : Form
  public partial class Form1 : Form
  {
  {
158. sor: 161. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
170. sor: 173. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public partial class Form1 : Form
  public partial class Form1 : Form
  {
  {
203. sor: 207. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
215. sor: 219. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public class Program
  public class Program
  {
  {
235. sor: 240. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
247. sor: 252. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  public class Singleton
  public class Singleton
  {
  {
265. sor: 271. sor:
     public void Print() {/* ... */}
     public void Print() {/* ... */}
  }
  }
</syntaxhighlight>


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


{{Infobox
{{Infobox
283. sor: 291. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  class SelectIntoDataSet{
  class SelectIntoDataSet{
     public static void Main(){
     public static void Main(){
313. sor: 322. sor:
     }
     }
  }
  }
 
</syntaxhighlight>


{{Infobox
{{Infobox
325. sor: 334. sor:
}}
}}
}}
}}
<syntaxhighlight lang="csharp">
  [AttributeUsage(AttributeTargets.All)]
  [AttributeUsage(AttributeTargets.All)]
  public class AuthorAttribute : System.Attribute
  public class AuthorAttribute : System.Attribute
343. sor: 353. sor:
     }
     }
  }
  }
</syntaxhighlight>


<syntaxhighlight lang="csharp">
  // Használata
  // Használata
  [Author("Béla Béla")]
  [Author("Béla Béla")]
350. sor: 362. 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))
356. sor: 370. sor:
     Console.WriteLine(attribute);
     Console.WriteLine(attribute);
  }
  }
</syntaxhighlight>


   
   
A lap eredeti címe: „https://vik.wiki/Sznikák_példakódok