<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.plecko.hr/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.plecko.hr/feed.php">
        <title>Eureka Moment development:csharp</title>
        <description></description>
        <link>https://wiki.plecko.hr/</link>
        <image rdf:resource="https://wiki.plecko.hr/lib/tpl/bootstrap3/images/favicon.ico" />
       <dc:date>2026-05-09T16:34:04+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:byte_to_bin_and_vice_versa&amp;rev=1621419423&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:converting_bytes&amp;rev=1621534940&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:create_zip&amp;rev=1631624857&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:lists_and_dictionaries&amp;rev=1622116414&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:marshaling&amp;rev=1650540440&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:multithreaded_tcp_listener&amp;rev=1621419787&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:password_masking&amp;rev=1631511089&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:start&amp;rev=1621418743&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.plecko.hr/doku.php?id=development:csharp:threadpool&amp;rev=1622626349&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.plecko.hr/lib/tpl/bootstrap3/images/favicon.ico">
        <title>Eureka Moment</title>
        <link>https://wiki.plecko.hr/</link>
        <url>https://wiki.plecko.hr/lib/tpl/bootstrap3/images/favicon.ico</url>
    </image>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:byte_to_bin_and_vice_versa&amp;rev=1621419423&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-19T12:17:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:byte_to_bin_and_vice_versa</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:byte_to_bin_and_vice_versa&amp;rev=1621419423&amp;do=diff</link>
        <description>C# Converting byte to binary string and vice versa


string a = Convert.ToString(value, 2).PadLeft(8, '0');   // Convert byte (value) to binary string
byte a = Convert.ToByte(NewFlags, 2);                    // Convert binary string to byte</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:converting_bytes&amp;rev=1621534940&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-20T20:22:20+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:converting_bytes</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:converting_bytes&amp;rev=1621534940&amp;do=diff</link>
        <description>C# Reading from and writing to byte array


Byte[] ByteName = new Byte[101];                                 // Declare bytearray
Buffer.BlockCopy(bytes, 0, ByteName, 0, 101);                    // Copy part of byte array (bytes) to ByteName
string Name = Encoding.UTF8.GetString(ByteName).TrimEnd('\0');   // Convert to string, and trim

bytes[100]                             // UInt8 on location 100
BitConverter.ToUInt16(bytes, 101);     // UInt16 on location 101 (has length 2 bytes)
BitConverte…</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:create_zip&amp;rev=1631624857&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-09-14T15:07:37+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:create_zip</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:create_zip&amp;rev=1631624857&amp;do=diff</link>
        <description>Create zip archive in C# .NET Core 5


using SaveFileDialog sfd = new() { Filter = &quot;Zip archive|*.zip&quot;, Title = &quot;Save zip file&quot;, AddExtension = true, DefaultExt = &quot;.zip&quot; };
  sfd.ShowDialog();
  if (sfd.FileName != &quot;&quot;)
  {
    using var memoryStream = new MemoryStream();
    using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
    {
      using var entryStreamFileDB = archive.CreateEntry(&quot;file.ext&quot;).Open();
      using StreamWriter streamWriterDB = new(entryStreamFileD…</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:lists_and_dictionaries&amp;rev=1622116414&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-27T13:53:34+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:lists_and_dictionaries</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:lists_and_dictionaries&amp;rev=1622116414&amp;do=diff</link>
        <description>C# lists and dictionaries


// List
List&lt;string&gt; list = new();
list.add(&quot;alpha&quot;);
list.add(&quot;beta&quot;);
if (list.Contains(&quot;alpha&quot;)) { }
list.ForEach(delegate(String val)
{
    val;
});
list.Remove(&quot;alpha&quot;);

// Dictionary
Dictionary&lt;string, UInt16&gt; dict = new();
dict[&quot;alpha&quot;] = 1;
dict[&quot;beta&quot;] = 2;
if (dict.ContainsKey(&quot;alpha&quot;)) { }
foreach (KeyValuePair&lt;string, UInt16&gt; entry in [dictionary])
{ 
    entry.Key;
    entry.Value;
}
dict.Remove(&quot;alpha&quot;);</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:marshaling&amp;rev=1650540440&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-21T13:27:20+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:marshaling</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:marshaling&amp;rev=1650540440&amp;do=diff</link>
        <description>C# Marshaling - write bytes to struct and vice versa


[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MyStructure
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 101)]
    public char[] Name;
    public UInt16 Port;
    public byte Num;
    public byte Max;
    public UInt64 Version;
    public byte TOD;
    public byte Avg;
    public byte Flags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
    public char[] Key;
}
public static MyStructure BytesToMyStructure(…</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:multithreaded_tcp_listener&amp;rev=1621419787&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-19T12:23:07+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:multithreaded_tcp_listener</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:multithreaded_tcp_listener&amp;rev=1621419787&amp;do=diff</link>
        <description>Multithreaded TCP listener in C#


static TcpListener server;
Int32 port = 8889;
IPAddress localAddr = IPAddress.Parse(&quot;0.0.0.0&quot;);
server = new TcpListener(localAddr, port);
ThreadPool.QueueUserWorkItem(ConnectionServer, server);

private static void ConnectionServer(object obj)
{
  var server = (TcpListener)obj;
  try
  {
    server.Start();
    while (true)
    {
      TcpClient tcpclient = server.AcceptTcpClient();
      ThreadPool.QueueUserWorkItem(ConnectionProcessor, tcpclient);
    }
  }
…</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:password_masking&amp;rev=1631511089&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-09-13T07:31:29+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:password_masking</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:password_masking&amp;rev=1631511089&amp;do=diff</link>
        <description>Efficient password string masking


return string.Create(clearValue.Length, clearValue, (span, value) =&gt;
{
    value.AsSpan().CopyTo(span):
    span[3..].Fill('*');
});</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:start&amp;rev=1621418743&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-19T12:05:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:start</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:start&amp;rev=1621418743&amp;do=diff</link>
        <description>C#




	* C# Converting byte to binary string and vice versa
	* C# lists and dictionaries
	* C# Marshaling - write bytes to struct and vice versa
	* C# Reading from and writing to byte array
	* Create zip archive in C# .NET Core 5
	* Efficient password string masking
	* Multithreaded TCP listener in C#
	* Threadpool</description>
    </item>
    <item rdf:about="https://wiki.plecko.hr/doku.php?id=development:csharp:threadpool&amp;rev=1622626349&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-06-02T11:32:29+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>development:csharp:threadpool</title>
        <link>https://wiki.plecko.hr/doku.php?id=development:csharp:threadpool&amp;rev=1622626349&amp;do=diff</link>
        <description>Threadpool


private static aaa() 
{
    ThreadPool.QueueUserWorkItem(threadWorker,this);
}

private static void threadWorker(object obj)
{
    Form1 f = (Form1)obj;
    {
        if (f.comboFrom.InvokeRequired)
        {
            f.comboFrom.Invoke(new ComboAddThreadSafeDelegate(ComboAddThreadSafe), f, ComboItem);
        }
    }
}

private delegate void ComboAddThreadSafeDelegate(Form1 f, String val);
private static void ComboAddThreadSafe(Form1 f, String val)
{
    f.comboFrom.Items.Add(va…</description>
    </item>
</rdf:RDF>
