ToString() public method

public ToString ( ) : string
return string
Beispiel #1
0
 public override string ToString()
 {
     if (copyDescription != IntPtr.Zero) {
         var ptr = CFReadStreamRef_InvokeCopyDescription (copyDescription, Info);
         if (ptr != IntPtr.Zero) {
             // Copy* -> so we must not retain again
             using (var s = new CFString (ptr, true))
                 return s.ToString ();
         }
     }
     return base.ToString ();
 }
 public void CheckAttachments()
 {
     var types = CMClockType.Assembly.GetTypes ()
         .Where(t => CMAttachmentInterfaceType.IsAssignableFrom(t) && !t.IsInterface);
     foreach (var t in types) {
         ICMAttachmentBearer obj = GetInstance (t);
         if (obj is NSObject)
             continue;
         Assert.That (obj.Handle, Is.Not.EqualTo (IntPtr.Zero), t.Name + ".Handle");
         using (var attch = new CFString ("myAttch")) {
             var mode = CMAttachmentMode.ShouldNotPropagate;
             CMAttachmentMode otherMode;
             obj.SetAttachment ("key", attch, CMAttachmentMode.ShouldNotPropagate);
             using (var otherAttch = obj.GetAttachment<CFString> ("key", out otherMode)) {
                 obj.RemoveAllAttachments ();
                 Assert.AreEqual (mode, otherMode);
                 Assert.IsNotNull (otherAttch, "For type {0}", t.Name);
                 Assert.AreEqual (attch.ToString (), otherAttch.ToString (), "For type {0}", t.Name);
             }
         }
         if (t is IDisposable) {
             var disposable = obj as IDisposable;
             disposable.Dispose ();
         }
     }
 }