當前位置: 首頁>>代碼示例>>C#>>正文


C# PhpArray.IsEmpty方法代碼示例

本文整理匯總了C#中PHP.Core.PhpArray.IsEmpty方法的典型用法代碼示例。如果您正苦於以下問題:C# PhpArray.IsEmpty方法的具體用法?C# PhpArray.IsEmpty怎麽用?C# PhpArray.IsEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHP.Core.PhpArray的用法示例。


在下文中一共展示了PhpArray.IsEmpty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: imagesetstyle

        public static bool imagesetstyle(PhpResource im, PhpArray styles)
        {
            PhpGdImageResource img = PhpGdImageResource.ValidImage(im);
            if (img == null)
                return false;
            
            if (styles == null || styles.IsEmpty())
            {
                return false;
            }

            Bitmap brushImage = new Bitmap(styles.Count, 1);

            int i = 0;
            foreach (int value in styles.Values)
            {
                brushImage.SetPixel(i, 0, PHPColorToNETColor(value));
                i++;
            }

            img.styled = new TextureBrush(brushImage);

            return true;
        }
開發者ID:proff,項目名稱:Phalanger,代碼行數:24,代碼來源:PhpGd.cs

示例2: Select

		public static int Select(ref PhpArray read, ref PhpArray write, ref PhpArray except, int tv_sec, int tv_usec)
		{
			if ((read == null || read.IsEmpty()) && (write == null || write.IsEmpty()))
				return except == null ? 0 : except.Count;

			var readResult = new PhpArray();
			var writeResult = new PhpArray();
			var i = 0;
			var timer = Stopwatch.StartNew();
			var waitTime = tv_sec*1000 + tv_usec;
			while (true)
			{
				if (read != null)
				{
					readResult.Clear();
					foreach (var item in read)
					{
						var stream = item.Value as PhpStream;
						if (stream == null)
							continue;
						if (stream.CanReadWithoutLock())
							readResult.Add(item.Key, item.Value);
					}
				}
				if (write != null)
				{
					writeResult.Clear();
					foreach (var item in write)
					{
						var stream = item.Value as PhpStream;
						if (stream == null)
							continue;
						if (stream.CanWriteWithoutLock())
							writeResult.Add(item.Key, item.Value);
					}
				}
				if (readResult.Count > 0 || writeResult.Count > 0 || except.Count > 0)
					break;
				i++;
				if (timer.ElapsedMilliseconds > waitTime)
					break;
				if (i < 10)
					Thread.Yield();
				else
					Thread.Sleep(Math.Min(i, waitTime));
			}
			read = readResult;
			write = writeResult;
			return read.Count + write.Count + (except == null ? 0 : except.Count);
		}
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:50,代碼來源:Streams.cs


注:本文中的PHP.Core.PhpArray.IsEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。