当前位置: 首页>>代码示例>>C#>>正文


C# Foundation.NSString类代码示例

本文整理汇总了C#中XamCore.Foundation.NSString的典型用法代码示例。如果您正苦于以下问题:C# NSString类的具体用法?C# NSString怎么用?C# NSString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NSString类属于XamCore.Foundation命名空间,在下文中一共展示了NSString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddSharedWebCredential

        public static void AddSharedWebCredential(string domainName, string account, string password, Action<NSError> handler)
        {
            if (domainName == null)
                throw new ArgumentNullException ("domainName");
            if (account == null)
                throw new ArgumentNullException ("account");
            // we need to create our own block literal. We can reuse the SDActionArity1V12 which is generated and takes a
            // NSError because a CFError is a toll-free bridget to CFError
            unsafe {
                BlockLiteral *block_ptr_onComplete;
                BlockLiteral block_onComplete;
                block_onComplete = new BlockLiteral ();
                block_ptr_onComplete = &block_onComplete;
                block_onComplete.SetupBlock (ActionTrampoline.Handler, handler);

                using (var nsDomain = new NSString (domainName))
                using (var nsAccount = new NSString (account)) {
                    if (password == null) {  // we are removing a password
                        SecAddSharedWebCredential (nsDomain.Handle, nsAccount.Handle, IntPtr.Zero, (IntPtr) block_ptr_onComplete);
                    } else {
                        using (var nsPassword = new NSString (password)) {
                            SecAddSharedWebCredential (nsDomain.Handle, nsAccount.Handle, nsPassword.Handle, (IntPtr) block_ptr_onComplete);
                        }
                    }
                    block_ptr_onComplete->CleanupBlock ();
                }
            }
        }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: RequestSharedWebCredential

        public static void RequestSharedWebCredential(string domainName, string account, Action<string[], NSError> handler)
        {
            // do not check domain an account because they can be null
            Action<NSArray, NSError> onComplete = (NSArray a, NSError e) => {
                // get a string [] for the user rather than an ugly NSArray
                var array = NSArray.StringArrayFromHandle (a.Handle);
                handler (array, e);
            };
            // we need to create our own block literal.
            unsafe {
                BlockLiteral *block_ptr_onComplete;
                BlockLiteral block_onComplete;
                block_onComplete = new BlockLiteral ();
                block_ptr_onComplete = &block_onComplete;
                block_onComplete.SetupBlock (ArrayErrorActionTrampoline.Handler, onComplete);

                NSString nsDomain = null;
                if (domainName != null)
                    nsDomain = new NSString (domainName);

                NSString nsAccount = null;
                if (account != null)
                    nsAccount = new NSString (account);

                SecRequestSharedWebCredential ((nsDomain == null)? IntPtr.Zero : nsDomain.Handle, (nsAccount == null)? IntPtr.Zero : nsAccount.Handle,
                    (IntPtr) block_ptr_onComplete);
                block_ptr_onComplete->CleanupBlock ();
                if (nsDomain != null)
                    nsDomain.Dispose ();
                if (nsAccount != null)
                    nsAccount.Dispose ();
            }
        }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例3: RegisterClassForCell

        public void RegisterClassForCell(Type cellType, NSString reuseIdentifier)
        {
            if (cellType == null)
                throw new ArgumentNullException ("cellType");

            RegisterClassForCell (Class.GetHandle (cellType), reuseIdentifier);
        }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: BestDepth

        public static NSWindowDepth BestDepth(NSString colorspace, nint bitsPerSample, nint bitsPerPixel, bool planar, ref bool exactMatch)
        {
            if (colorspace == null)
                throw new ArgumentNullException ("colorspace");

            return NSBestDepth (colorspace.Handle, bitsPerSample, bitsPerPixel, planar, ref exactMatch);
        }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: RemoveTag

 public bool RemoveTag(CGImageMetadataTag parent, NSString path)
 {
     IntPtr p = parent == null ? IntPtr.Zero : parent.Handle;
     if (path == null)
         throw new ArgumentNullException ("path");
     return CGImageMetadataRemoveTagWithPath (Handle, p, path.Handle);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: MakeSetFromTags

 static NSSet MakeSetFromTags(string [] tags)
 {
     var x = new NSString [tags.Length];
     for (int i = 0; i < tags.Length; i++)
         x [i] = new NSString (tags [i]);
     return new NSSet (x);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例7: UISegmentedControl

        public UISegmentedControl(object [] args)
            : base(NSObjectFlag.Empty)
        {
            if (args == null)
                throw new ArgumentNullException ("args");

            NSObject [] nsargs = new NSObject [args.Length];

            for (int i = 0; i < args.Length; i++){
                object a = args [i];

                if (a == null)
                    throw new ArgumentNullException (String.Format ("Element {0} in args is null", i));

                if (a is string)
                    nsargs [i] = new NSString ((string) a);
                else if (a is UIImage)
                    nsargs [i] = (UIImage) a;
                else
                    throw new ArgumentException (String.Format ("non-string or UIImage at position {0} with type {1}", i, a.GetType ()));
            }
            using (NSArray nsa = NSArray.FromNSObjects (nsargs)){
                Handle = InitWithItems (nsa.Handle);
            }
        }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例8: ToString

        public static string ToString(NSDictionary address, bool addCountryName)
        {
            if (address == null)
                throw new ArgumentNullException ("address");

            using (NSString s = new NSString (ABCreateStringWithAddressDictionary (address.Handle, addCountryName)))
                return s.ToString ();
        }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例9: CFException

 public CFException(string description, NSString domain, nint code, string failureReason, string recoverySuggestion)
     : base(description)
 {
     Code                = code;
     Domain              = domain;
     FailureReason       = failureReason;
     RecoverySuggestion  = recoverySuggestion;
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例10: SetString

        public void SetString(string value, string defaultName)
        {
            NSString str = new NSString (value);

            SetObjectForKey (str, defaultName);

            str.Dispose ();
        }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例11: Remove

 public bool Remove(NSScriptCommandArgumentDescription arg)
 {
     if (arg == null)
         throw new ArgumentNullException ("arg");
     using (var nsName = new NSString (arg.Name)) {
         return Arguments?.Remove (nsName) ?? false;
     }
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例12: VTVideoEncoder

 internal VTVideoEncoder(NSNumber codecType, NSString codecName, NSString displayName, NSString encoderId, NSString encoderName)
 {
     CodecType = codecType.Int32Value;
     CodecName = codecName;
     DisplayName = displayName;
     EncoderId = encoderId;
     EncoderName = encoderName;
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例13: IsDeclared

		public static bool IsDeclared (string utType)
		{
			if (utType == null)
				throw new ArgumentNullException ("utType");

			using (var x = new NSString (utType)) 
				return UTTypeIsDeclared (x.Handle) != 0;
		}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例14: ObjectForKey

 public NSObject this[NSString key]
 {
     get {
         return ObjectForKey (key);
     }
     set {
         SetObjectForKey (value, key);
     }
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例15: SetTag

 public bool SetTag(CGImageMetadataTag parent, NSString path, CGImageMetadataTag tag)
 {
     IntPtr p = parent == null ? IntPtr.Zero : parent.Handle;
     if (path == null)
         throw new ArgumentNullException ("path");
     if (tag == null)
         throw new ArgumentNullException ("tag");
     return CGImageMetadataSetTagWithPath (Handle, p, path.Handle, tag.Handle);
 }
开发者ID:,项目名称:,代码行数:9,代码来源:


注:本文中的XamCore.Foundation.NSString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。