Softwareentwicklung

In dieser Sektion sollen nützliche Programme, Code-Schnipsel, Links zu interessanten Frameworks, etc. stehen.

Bibliotheken

C / C++

.NET

Code-Schnipsel

C#

Allgemeine Array-Compare Methode

1
static bool ArraysEqual<T>(T[] a1, T[] a2)
{
    if (ReferenceEquals(a1,a2))
        return true;
 
    if (a1 == null || a2 == null)
        return false;
 
    if (a1.Length != a2.Length)
        return false;
 
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;
    for (int i = 0; i < a1.Length; i++)
    {
        if (!comparer.Equals(a1[i], a2[i])) return false;
    }
    return true;
}

Byte Array nach Hex-String

1
private string ByteArrayToHexString(byte[] arr)
{
    return Regex.Replace(BitConverter.ToString(arr), "[^A-F0-9]", "");
}

ASCII Byte Array nach String / String nach ASCII Byte Array

1
private byte[] StringToByteArray(string str)
{
    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
    return enc.GetBytes(str);
}
 
private string ByteArrayToString(byte[] arr)
{
    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
    return enc.GetString(arr);
}

Links

Tutorials

Projekte

Tools / Add-Ins

coding/start.txt · Zuletzt geändert: 2015/10/15 12:38 von octoate
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0