forked from pascalabcnet/pascalabcnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringStack.cs
More file actions
36 lines (34 loc) · 1.3 KB
/
StringStack.cs
File metadata and controls
36 lines (34 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//------------------------------------------------------------------------------
/// <copyright from='1997' to='2002' company='Microsoft Corporation'>
/// Copyright (c) Microsoft Corporation. All Rights Reserved.
///
/// This source code is intended only as a supplement to Microsoft
/// Development Tools and/or on-line documentation. See these other
/// materials for detailed information regarding Microsoft code samples.
///
/// </copyright>
//------------------------------------------------------------------------------
namespace SampleDesignerHost
{
using System;
using System.Collections;
/// This is just a special stack to handle the transaction descriptions.
/// It functions like a normal stack, except it looks for the first
/// non-null (and non "") string.
internal class StringStack : Stack {
internal StringStack() {
}
internal string GetNonNull() {
int items = this.Count;
object item;
object[] itemArr = this.ToArray();
for (int i = items - 1; i >=0; i--) {
item = itemArr[i];
if (item != null && item is string && ((string)item).Length > 0) {
return (string)item;
}
}
return "";
}
}
}