que tiene la siguiente estructura:C# ToCharArray no funciona con char *
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
unsafe public struct Attributes
{
public OrderCommand Command { get; set; }
public int RefID { get; set; }
public fixed char MarketSymbol[30];
}
Ahora, yo quiero escribir caracteres a la MarketSymbol campo:
string symbol = "test";
Attributes.MarketSymbol = symbol.ToCharArray();
El compilador genera un error, diciendo no puede convertir de char [] a char *. ¿Cómo debo escribir esto? Gracias
Tal vez ayude: http://stackoverflow.com/questions/1185269/how-to-convert-fixed-byte-char100-to-managedchar-in-c. – Samich