public static unsafe void AddLineAtX(IntPtr pointer, double x, double thick, byte r, byte g, byte b) { GCHandle handle = GCHandle.FromIntPtr(pointer); if (handle.IsAllocated) { PlotModel model = handle.Target as PlotModel; if (model != null) { model.AddLineAtX(x, OxyColor.FromRgb(r, g, b), thick); } } }