52 minutes ago, BitFlipper wrote
public static extension class string
{
public static string Longest(string s1, string s2)
{
if (s1 == null)
return s2;
if (s2 == null)
return s1;
return s1.Length >= s2.Length ? s1 : s2;
}
}...or...
public static extension struct float
{
public static float[] FromPcm16(Int16[] srcBuffer)
{
var dstBuffer = new float[srcBuffer.Length];
// Convert to float...
return dstBuffer;
}
}
What's wrong with
public static class StringHelper
{
public static string Longest(string s1, string s2)
{
if (s1 == null)
return s2;
if (s2 == null)
return s1;
return s1.Length >= s2.Length ? s1 : s2;
}
}
...or...
public static struct FloatHelper
{
public static float[] FromPcm16(Int16[] srcBuffer)
{
var dstBuffer = new float[srcBuffer.Length];
// Convert to float...
return dstBuffer;
}
}