I'm trying to get the bytes for different objects of different types using [`BitConverter.GetBytes`](https://msdn.microsoft.com/en-us/library/system.bitconverter.getbytes(v=vs.90).aspx). In order to do this, **I'd like to write a generic extension method**, rather than write individual extension methods for every type I want to work with (short, long, ulong, etc).

**Is this possible?**

Here's the (not working) code I have so far for the generic method:

```
public static byte[] Foo<T>(this T input) where T : struct
{
    // error here, no match to overloads
    var result = BitConverter.GetBytes(input);
    // do more logic here...
    return result;
}

```

By the way, this must be .NET 3.5 compliant.