using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace MyOwnGeneric
{
class OwnObject<T>
{
private T content;
private OwnObject<T> next;
public T Content
{
get { return content; }
set { content = value; }
}
public OwnObject<T> Next
{
get { return next; }
set { next = value; }
}
public override string ToString()
{
return content.ToString();
}
}
class LinList<T> : IEnumerable<T>
{
private OwnObject<T> first;
private OwnObject<T> last;
public OwnObject<T> First
{
get { return first; }
set { first = value; }
}
public OwnObject<T> Last
{
get { return last; }
set { last = value; }
}
public void Add(OwnObject<T> item)
{
if (first == null)
{
first = item;
last = item;
}
else
{
last.Next = item;
last = item;
}
}
//function to count items in LinList
public int Count()
{
int counter = 0;
OwnObject<T> position = first;
while (position != null)
{
counter++;
position = position.Next;
}
return counter;
}
//function to get the content at a fix position in LinList
public T GetItem(int pos)
{
int counter = 0;
OwnObject<T> position = first;
//T result = null not possible because value type
T result = default(T);
while (position != null)
{
if (counter == pos)
{
result = position.Content;
break;
}
counter++;
position = position.Next;
}
return result;
}
public override string ToString()
{
string result = "";
OwnObject<T> position = first;
while (position != null)
{
result += position.ToString();
if (position.Next != null)
result += " - ";
position = position.Next;
}
return result;
}
//indexer
public T this[int index]
{
get
{
return this.GetItem(index);
}
}
//interface IEnumerable
public IEnumerator<T> GetEnumerator()
{
OwnObject<T> position = first;
while (position != null)
{
yield return position.Content;
position = position.Next;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
class Program
{
static void Main(string[] args)
{
LinList<string> test = new LinList<string>();
OwnObject<string> testcont = new OwnObject<string>();
testcont.Content = "test";
OwnObject<string> testcont2 = new OwnObject<string>();
testcont2.Content = "test2";
OwnObject<string> testcont3 = new OwnObject<string>();
testcont3.Content = "test3";
test.Add(testcont);
test.Add(testcont2);
test.Add(testcont3);
//using the interface of IEnumerable
foreach (string item in test)
{
Console.WriteLine(item);
}
//using the indexer and the item counter
for (int i = 0; i < test.Count(); i++)
{
Console.WriteLine(test[i]);
}
}
}
}
using System;
namespace parameters
{
public static class democlass
{
//normal use
public static int Add(int left, int right)
{
return left + right;
}
//use the ref Parameter, e.g. for increment
public static void AddPlus(ref int number)
{
number = number + 1;
}
//use the out Parameter
public static void GetHundred(out int number)
{
number = 100;
}
}
class Program
{
static void Main(string[] args)
{
int a = 10;
int b = 20;
int c;
c = democlass.Add(a, b);
Console.WriteLine(c); //30
democlass.AddPlus(ref c);
Console.WriteLine(c); //31
democlass.GetHundred(out c);
Console.WriteLine(c); //100
}
}
}
function measure(el, styleProp) {
if (el.currentStyle)
var st = el.currentStyle[styleProp];
else if (window.getComputedStyle)
var st = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
return st;
}
tell application "Vienna"
set unreadCount to total unread count
return "Vienna: " & unreadCount & " unread messages"
end tell
public function hideElement():Void{
ZigoEngine.doTween( this, '_alpha', [ 0 ], 1, "easeOutExpo", 0, {scope:this, func:'removeElement'});
} // END hideElement()
public function removeElement():Void{
this.removeMovieClip();
} // END removeElement()