コード例 #1
0
        public void NSPasteboardTests_WriteObjectTests()
        {
            NSPasteboard b = NSPasteboard.CreateWithUniqueName();

            if (b == null)
            {
                Assert.Inconclusive("NSPasteboard could not be provided by the OS.");
            }
            b.WriteObjects(new INSPasteboardWriting [] { (NSString)"asfd" });
            b.WriteObjects(new NSPasteboardWriting [] { new MyPasteboard() });
            // from the docs: the lifetime of a unique pasteboard is not related to the lifetime of the creating app,
            // you must release a unique pasteboard by calling releaseGlobally to avoid possible leaks.
            b.ReleaseGlobally();
        }