本文整理汇总了C#中XamCore.Foundation.NSString.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# NSString.Dispose方法的具体用法?C# NSString.Dispose怎么用?C# NSString.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XamCore.Foundation.NSString
的用法示例。
在下文中一共展示了NSString.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetString
public void SetString(string value, string defaultName)
{
NSString str = new NSString (value);
SetObjectForKey (str, defaultName);
str.Dispose ();
}
示例2: GlobalSetClassName
public static void GlobalSetClassName(string name, Class kls)
{
if (name == null)
throw new ArgumentNullException ("name");
if (kls == null)
throw new ArgumentNullException ("kls");
var nsname = new NSString (name);
XamCore.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle ("setClassName:forClass:"), nsname.Handle, kls.Handle);
nsname.Dispose ();
}
示例3: ExtractAccessoryInfo
static AccessoryInfo[] ExtractAccessoryInfo(IntPtr ptr, NSString id, NSString description)
{
using (var array = new CFArray (ptr)) {
var res = new AccessoryInfo [array.Count];
for (int i = 0; i < res.Length; ++i) {
var dict = array.GetValue (i);
var n = new NSNumber (CFDictionary.GetValue (dict, id.Handle));
var desc = CFString.FetchString (CFDictionary.GetValue (dict, description.Handle));
res [i] = new AccessoryInfo ((int) n, desc);
id.Dispose ();
}
return res;
}
}
示例4: CreateRequest
public static CFHTTPMessage CreateRequest (Uri uri, string method, Version version)
{
if (uri == null)
throw new ArgumentNullException ("uri");
CFUrl urlRef = null;
NSString methodRef = null;
var escaped = Uri.EscapeUriString (uri.ToString ());
try {
urlRef = CFUrl.FromUrlString (escaped, null);
if (urlRef == null)
throw new ArgumentException ("Invalid URL.");
methodRef = new NSString (method);
return CreateRequest (urlRef, methodRef, version);
} finally {
if (urlRef != null)
urlRef.Dispose ();
if (methodRef != null)
methodRef.Dispose ();
}
}