本文整理汇总了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;
}
示例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);
}