<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming</title>
	<atom:link href="http://programming.sajjad.biz/feed/" rel="self" type="application/rss+xml" />
	<link>http://programming.sajjad.biz</link>
	<description>Tips &#38; Ticks by SAJJAD</description>
	<lastBuildDate>Mon, 23 Aug 2010 17:34:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>C# implicit operator</title>
		<link>http://programming.sajjad.biz/34/c-implicit-operator/</link>
		<comments>http://programming.sajjad.biz/34/c-implicit-operator/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 10:46:54 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=34</guid>
		<description><![CDATA[public class StringSafe { /// < summary> /// Empty value /// < /summary> public const string Empty = ""; /// < summary> /// String to StringSafe /// < /summary> /// < param name="data">object< /param> /// < returns>< /returns> public static implicit operator StringSafe(String data) { if (data == null) return Empty; return new StringSafe(data); } <a href="http://programming.sajjad.biz/34/c-implicit-operator/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
public class StringSafe
{
	/// < summary>
	/// Empty value
	/// < /summary>
	public const string Empty = "";

	/// < summary>
	/// String to StringSafe
	/// < /summary>
	/// < param name="data">object< /param>
	/// < returns>< /returns>
	public static implicit operator StringSafe(String data)
	{
		if (data == null)
			return Empty;

		return new StringSafe(data);
	}

	/// < summary>
	/// StringSafe to String
	/// < /summary>
	/// < param name="data">object< /param>
	/// < returns>< /returns>
	public static implicit operator String(StringSafe data)
	{
		if (data == null)
			return Empty;

		return data.value;
	}

	private String value = Empty;
	/// < summary>
	/// Value
	/// < /summary>
	public String Value
	{
		get
		{
			if (this.value == null)
			return Empty;

			return this.value;
		}
		set
		{
			if (value == null)
			this.value = Empty;
			else
			this.value = value;
		}
	}

	/// < summary>
	/// Create new instance of StringSafe
	/// < /summary>
	/// < param name="value">< /param>
	public StringSafe(String value = Empty)
	{
		this.value = value;
	}
}
</pre>
<p><strong>Sample</strong></p>
<pre name="code" class="csharp">
public class Program
{
	StringSafe sf = "SAJJAD";
	MessageBox.Show(sf);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/34/c-implicit-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anonymous Struct</title>
		<link>http://programming.sajjad.biz/33/anonymous-struct/</link>
		<comments>http://programming.sajjad.biz/33/anonymous-struct/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 13:24:38 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=33</guid>
		<description><![CDATA[var Freinds = new[] { new { Name = "Ali", Age = 23 , Married = false }, new { Name = "Reza", Age = 43 , Married = true }, new { Name = "Ehsan", Age = 36 , Married = true }, new { Name = "Mahdi", Age = 34 , Married = <a href="http://programming.sajjad.biz/33/anonymous-struct/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
var Freinds = new[]
{
	new { Name = "Ali", Age = 23 , Married = false },
	new { Name = "Reza", Age = 43  , Married = true },
	new { Name = "Ehsan", Age = 36 , Married = true },
	new { Name = "Mahdi", Age = 34 , Married = false }
};

String Output = String.Empty;

foreach (var v in Freinds.Where(a => a.Married))
	Output += "Name: " + v.Name + ", Age:" + v.Age + ";";

if (Output.Length > 0)
	MessageBox.Show(Output.Substring(0, Output.Length - 1));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/33/anonymous-struct/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Sarray (Advaned Generic/Object Array)</title>
		<link>http://programming.sajjad.biz/31/sarray/</link>
		<comments>http://programming.sajjad.biz/31/sarray/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 17:03:39 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Collectable]]></category>
		<category><![CDATA[Dequeue]]></category>
		<category><![CDATA[Disposable]]></category>
		<category><![CDATA[Enqueue]]></category>
		<category><![CDATA[Enumerable]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[IDisposable]]></category>
		<category><![CDATA[Listable]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Queueable]]></category>
		<category><![CDATA[Sarray]]></category>
		<category><![CDATA[Stackable]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=31</guid>
		<description><![CDATA[Sarray: Queueable, Stackable, Enumerable, Collectable, Listable, Disposable, Timmeable Array ! Add, Insert, Remove, Enqueue, Dequeue, Pop, Push @ Range Enjoy, SAJJAD [System.Diagnostics.DebuggerDisplay("Count = { Count }")] public class Sarray< T > : ISarray, ISarray< T > { protected T[] Items; public Sarray(bool queueTimered, double timmerTick, int queuesCapacity) { this.Clear(); if (queueTimered) { this.queueTimer = new <a href="http://programming.sajjad.biz/31/sarray/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Sarray: Queueable, Stackable, Enumerable, Collectable, Listable, Disposable, Timmeable Array !<br />
Add, Insert, Remove, Enqueue, Dequeue, Pop, Push @ Range</p>
<p>Enjoy, <strong>SAJJAD</strong></p>
<pre name="code" class="csharp">
    [System.Diagnostics.DebuggerDisplay("Count = { Count }")]
    public class Sarray< T > : ISarray, ISarray< T >
    {
        protected T[] Items;

        public Sarray(bool queueTimered, double timmerTick, int queuesCapacity)
        {
            this.Clear();

            if (queueTimered)
            {
                this.queueTimer = new Timer(timmerTick);
                this.queueTimer.Elapsed += new ElapsedEventHandler(queueTimer_Elapsed);
            }

            this.queuesCapacity = queuesCapacity;

            this.Enqueues();
            this.Dequeues();

            if (queueTimered)
            {
                this.queueTimer.Start();
            }
        }

        #region { List }

        int IList.Add(object value)
        {
            return this.InsertCore(this.Items.Length, (T)value);
        }

        void IList.Clear()
        {
            this.Clear();
        }

        bool IList.Contains(object value)
        {
            return this.Contains((T)value);
        }

        int IList.IndexOf(object value)
        {
            return this.IndexOf((T)value);
        }

        void IList.Insert(int index, object value)
        {
            this.InsertCore(index, (T)value);
        }

        bool IList.IsFixedSize
        {
            get { return false; }
        }

        bool IList.IsReadOnly
        {
            get { return false; }
        }

        void IList.Remove(object value)
        {
            this.DeleteCore((T)value);
        }

        void IList.RemoveAt(int index)
        {
            this.DeleteCore(index, index + 1);
        }

        object IList.this[int index]
        {
            get
            {
                return this[index];
            }
            set
            {
                this[index] = (T)value;
            }
        }

        void ICollection.CopyTo(Array array, int index)
        {
            if (this.IsIndex(index, false))
            {
                Items.CopyTo(array, index);
            }
        }

        int ICollection.Count
        {
            get { return this.Items.Length; }
        }

        bool ICollection.IsSynchronized
        {
            get { return true; }
        }

        object ICollection.SyncRoot
        {
            get { return this; }
        }

        #endregion

        #region { IList< T > }

        public virtual int IndexOf(T item)
        {
            for (int i = 0; i < this.Items.Length; i++)
            {
                if (this.Items[i].Equals(item))
                    return i;
            }

            return -1;
        }

        public virtual void Insert(int index, T item)
        {
            this.InsertCore(index, item);
        }

        public virtual void RemoveAt(int index)
        {
            this.DeleteCore(index, index + 1);
        }

        public virtual T this[int index]
        {
            get
            {
                return this.Seek(index);
            }
            set
            {
                T co = this.Seek(index);
                if (co != null)
                {
                    co = value;
                }
            }
        }

        public virtual void Add(T item)
        {
            this.InsertCore(this.Items.Length, item);
        }

        public virtual void Clear()
        {
            this.Items = new T[] { };
        }

        public virtual bool Contains(T item)
        {
            foreach (T co in this.Items)
            {
                if (co.Equals(item))
                    return true;
            }
            return false;
        }

        public virtual void CopyTo(T[] array, int arrayIndex)
        {
            if (this.IsIndex(arrayIndex, false))
            {
                Array.Copy(this.Items, array, arrayIndex);
            }
        }

        public virtual int Count
        {
            get { return this.Items.Length; }
        }

        public virtual bool IsReadOnly
        {
            get { return false; }
        }

        public virtual bool Remove(T item)
        {
            return this.RemoveRange(item) > 0;
        }

        public virtual IEnumerator< T > GetEnumerator()
        {
            foreach (T co in this.Items)
                yield return co;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.Items.GetEnumerator();
        }

        #endregion

        #region { IDisposible }

        private bool disposed = false;
        public bool Disposed
        {
            get
            {
                return this.disposed;
            }
        }

        public virtual void Dispose()
        {
            if (!this.disposed)
            {
                this.Items = null;
                this.enqueue = null;
                this.dequeue = null;

                this.queueTimer.Dispose();
                this.queueTimer = null;
            }
        }

        #endregion

        public virtual bool IsIndex(int index, bool withEnd)
        {
            if (withEnd)
                return index >= 0 &#038;&#038; index <= this.Items.Length;

            return index >= 0 &#038;&#038; index < this.Items.Length;
        }

        public virtual T Seek(int index)
        {
            for (int i = 0; i < this.Items.Length; i++)
            {
                if (i == index)
                    return this.Items[i];
            }

            return default(T);
        }
        public virtual IEnumerable<T> Seek(int from, int to)
        {
            if (this.IsIndex(from, false) &#038;&#038; this.IsIndex(to, true) &#038;&#038; from < to &#038;&#038; from != to)
            {
                for (int i = 0; i < this.Items.Length; i++)
                {
                    if (i >= from &#038;&#038; i < to)
                    {
                        yield return this.Items[i];
                    }
                }
            }
        }

        public virtual int Push(T iteme)
        {
            return this.InsertCore(this.Items.Length, iteme);
        }
        public virtual int PushRange(params T[] itemes)
        {
            return this.InsertCore(this.Items.Length, itemes);
        }
        public virtual int AddRange(params T[] items)
        {
            return this.InsertCore(this.Items.Length, items);
        }
        public virtual int InsertRange(int index, params T[] items)
        {
            return this.InsertCore(index, items);
        }

        public virtual int Pop(int count = 1)
        {
            if (count > 0)
                return this.DeleteCore(this.Items.Length - count, this.Items.Length);

            return 0;
        }
        public virtual int RemoveRange(params T[] items)
        {
            return this.DeleteCore(items);
        }

        protected virtual int InsertCore(int index, params T[] items)
        {
            Int32 newRealMembers = 0;

            if (items != null &#038;&#038; this.IsIndex(index, true))
            {
                if (items.Length > 0) // At least one new child want added
                {
                    // We thing all new childs are new
                    T[] newMembers = new T[items.Length];

                    // Flag for child existance
                    Boolean exist = false;

                    // Check existance
                    foreach (T item in items)
                    {
                        if (item != null)
                        {
                            exist = false;
                            foreach (T at in this.Items)
                                if (at.Equals(item))
                                    exist = true;

                            if (!exist)
                                newMembers[newRealMembers++] = item;
                        }
                    }

                    if (newRealMembers > 0)
                    {
                        T[] newArray = new T[this.Items.Length + newRealMembers];

                        for (int i = 0, j = 0; i < newArray.Length; )
                        {
                            if (index == i)
                            {
                                for (int z = 0; z < newRealMembers; z++)
                                {
                                    newArray[i++] = newMembers[z];
                                }
                            }
                            else
                            {
                                newArray[i++] = this.Items[j++];
                            }
                        }
                        this.Items = newArray;
                    }
                }
            }

            return newRealMembers;
        }
        protected virtual int DeleteCore(params T[] items)
        {
            Int32 newMembers = 0, lastSize = 0;

            if (items != null)
            {
                if (items.Length > 0)
                {
                    T[] newArray = new T[this.Items.Length];

                    // Is item exist ?
                    Boolean exist = false;

                    // Find no selected childs
                    foreach (T t in this.Items)
                    {
                        exist = false;

                        foreach (T item in items)
                        {
                            if (t.Equals(item))
                            {
                                exist = true;
                                break;
                            }
                        }

                        if (!exist)
                        {
                            newArray[newMembers++] = t;
                        }
                    }

                    if (newMembers > 0 &#038;&#038; newMembers != this.Items.Length)
                    {
                        lastSize = this.Items.Length;
                        Array.Resize(ref newArray, newMembers);
                        this.Items = newArray;
                    }
                }
            }

            return lastSize - newMembers;
        }
        protected virtual int DeleteCore(int from, int to)
        {
            int applied = 0;

            if (this.IsIndex(from, false) &#038;&#038; this.IsIndex(to, true) &#038;&#038; from < to &#038;&#038; from != to)
            {
                T[] newArray = new T[this.Items.Length - (from - to)];

                for (int i = 0, newIndex = 0; i < this.Items.Length; i++)
                {
                    if (i >= from &#038;&#038; i < to)
                    {
                        newArray[newIndex++] = this.Items[i];
                    }
                }
                applied = from - to;
                this.Items = newArray;

            }

            return applied;
        }

        #region { Timer }

        private bool queueTimered = false;
        public bool QueueTimered
        {
            get
            {
                return this.queueTimered;
            }
        }

        private Timer queueTimer;
        private void queueTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.Enqueues();
            this.Dequeues();
        }

        ///
<summary>
        /// Queue Refresh Time (100 to 10000 ms, 1000 is default)
        /// </summary>

        public double QueueTick
        {
            get
            {
                return this.queueTimer.Interval;
            }
            set
            {
                if (value > 100 &#038;&#038; value < 10000 &#038;&#038; this.queueTimered)
                {
                    this.queueTimer.Interval = value;
                }
            }
        }

        #endregion

        protected int queuesCapacity = 0;
        public int QueuesCapacity
        {
            get
            {
                return this.queuesCapacity;
            }
            set
            {
                if (value >= 0 &#038;&#038; value <= 10000)
                {
                    this.queuesCapacity = value;
                }
            }
        }

        #region { Enqueue }

        protected T[] enqueue;

        protected int enqueueCount = 0;
        public int EnqueueCount
        {
            get
            {
                return this.enqueueCount;
            }
        }

        public virtual int Enqueue(params T[] items)
        {
            if (items != null)
            {
                if (items.Length > 0)
                {
                    if (this.enqueue.Length > enqueueCount + items.Length)
                    {
                        int added = 0, nulled = 0;
                        for (int i = 0; i < this.enqueue.Length; i++)
                        {
                            if (this.enqueue[i] == null)
                            {
                                foreach (T co in items)
                                {
                                    if (co == null)
                                    {
                                        nulled++;
                                    }
                                    else
                                    {
                                        this.enqueue[i] = co;
                                        added++;
                                        this.enqueueCount++;
                                        break;
                                    }
                                }

                                // All object checked
                                if (added + nulled == items.Length)
                                {
                                    break;
                                }
                            }
                        }

                        return added;
                    }
                    else
                    {
                        this.Enqueues();
                        return this.InsertCore(this.Items.Length, items);
                    }
                }
            }

            return 0;
        }

        public void Enqueues()
        {
            if (this.enqueue == null)
            {
                this.enqueue = new T[this.queuesCapacity];
            }

            if (this.enqueueCount > 0)
            {
                this.InsertCore(this.Items.Length, this.enqueue);
                this.enqueueCount = 0;
            }
        }

        #endregion

        #region { Dequeue }

        protected T[] dequeue;

        protected int dequeueCount = 0;
        public int DequeueCount
        {
            get
            {
                return this.dequeueCount;
            }
        }

        public virtual int Dequeue(params T[] items)
        {
            if (items != null)
            {
                if (items.Length > 0)
                {
                    if (this.dequeue.Length < dequeueCount + items.Length)
                    {
                        int added = 0, nulled = 0;
                        for (int i = 0; i < this.dequeue.Length; i++)
                        {
                            if (this.dequeue[i] == null)
                            {
                                foreach (T co in items)
                                {
                                    if (co == null)
                                    {
                                        nulled++;
                                    }
                                    else
                                    {
                                        this.dequeue[i] = co;
                                        added++;
                                        dequeueCount++;
                                        break;
                                    }
                                }

                                // All object checked
                                if (added + nulled == items.Length)
                                {
                                    break;
                                }
                            }
                        }

                        return added;
                    }
                    else
                    {
                        this.Dequeues();
                        return this.DeleteCore(items);
                    }
                }
            }

            return 0;
        }

        public void Dequeues()
        {
            if (this.dequeue == null)
            {
                this.dequeue = new T[this.queuesCapacity];
            }

            if (this.dequeueCount > 0)
            {
                this.DeleteCore(this.dequeue);
                this.dequeueCount = 0;
            }
        }

        #endregion
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/31/sarray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Define Field, Property, Method or Class</title>
		<link>http://programming.sajjad.biz/28/csharp-define-field-property-method-or-class/</link>
		<comments>http://programming.sajjad.biz/28/csharp-define-field-property-method-or-class/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 12:12:44 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Field]]></category>
		<category><![CDATA[Method]]></category>
		<category><![CDATA[Property]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=28</guid>
		<description><![CDATA[[&#124;new] [public&#124;internal&#124;protected&#124;private] [static] [&#124;virtual&#124;abstract&#124;sealed] [&#124;override] Type NAME;]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
[|new] [public|internal|protected|private] [static] [|virtual|abstract|sealed] [|override] Type NAME;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/28/csharp-define-field-property-method-or-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# partial Keyword</title>
		<link>http://programming.sajjad.biz/26/c-sharp-partial-keyword/</link>
		<comments>http://programming.sajjad.biz/26/c-sharp-partial-keyword/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 18:07:24 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Keyword]]></category>
		<category><![CDATA[partial]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=26</guid>
		<description><![CDATA[using System; namespace ConsoleApplication { static class Program { static void Main() { User a = new User(); Console.WriteLine(User.Instance); User b = new User(); Console.WriteLine(User.Instance); Console.Read(); } } public enum Gender { Male, Female } public partial class User { private Gender _gender; public Gender Gender { get { return this._gender; } set { this._gender <a href="http://programming.sajjad.biz/26/c-sharp-partial-keyword/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
using System;

namespace ConsoleApplication
{
	static class Program
	{
		static void Main()
		{
			User a = new User();
			Console.WriteLine(User.Instance);

			User b = new User();
			Console.WriteLine(User.Instance);

			Console.Read();
		}
	}

	public enum Gender
	{
		Male,
		Female
	}

	public partial class User
	{
		private Gender _gender;

		public Gender Gender
		{
			get
			{
				return this._gender;
			}

			set
			{
				this._gender = value;
			}
		}

		public User()
		{
			Instance++;
		}

		~User()
		{
			Instance--;
		}
	}

	public partial class User
	{
		public static int Instance = 0;
		public static readonly User Empty;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/26/c-sharp-partial-keyword/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# virtual Keywords: More speed</title>
		<link>http://programming.sajjad.biz/24/csharp-virtual-keywords-more-speed/</link>
		<comments>http://programming.sajjad.biz/24/csharp-virtual-keywords-more-speed/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 19:01:34 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Keywords]]></category>
		<category><![CDATA[virtual]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=24</guid>
		<description><![CDATA[using System; namespace ConsoleApplication { class Program { static void Main(string[] args) { Console.WriteLine("Area of 5 is: " + (new Circle(5).Area()).ToString()); Console.WriteLine("Perimeter of 5 is: " + (new Circle(5).Perimeter()).ToString()); Circle C = new Circle(8.5); Console.WriteLine("\nArea of 8.5 is: " + C.Area().ToString()); Console.WriteLine("Perimeter of 8.5 is: " + C.Perimeter().ToString()); Console.Read(); } } abstract class Shape { <a href="http://programming.sajjad.biz/24/csharp-virtual-keywords-more-speed/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
using System;

namespace ConsoleApplication
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.WriteLine("Area of 5 is: " + (new Circle(5).Area()).ToString());
			Console.WriteLine("Perimeter of 5 is: " + (new Circle(5).Perimeter()).ToString());

			Circle C = new Circle(8.5);
			Console.WriteLine("\nArea of 8.5 is: " + C.Area().ToString());
			Console.WriteLine("Perimeter of 8.5 is: " + C.Perimeter().ToString());

			Console.Read();
		}
	}

	abstract class Shape
	{
		public double X, Y;

		public Shape() : this(0) { }
		public Shape(double X)
		{
			this.X = this.Y = X;
		}
		public Shape(double X, double Y)
		{
			this.X = X;
			this.Y = Y;
		}

		public virtual double Area()
		{
			return this.X * this.Y;
		}

		public virtual double Perimeter()
		{
			return 2 * this.X * this.Y;
		}
	}

	sealed class Circle : Shape
	{
		public Circle() : base(0) { }
		public Circle(double Radius) : base(Radius) { }

		public override double Area()
		{
			return Math.PI * this.X * this.X;
		}

		public override double Perimeter()
		{
			return 2 * Math.PI * this.X;
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/24/csharp-virtual-keywords-more-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# params Keywords</title>
		<link>http://programming.sajjad.biz/23/csharp-params-keywords/</link>
		<comments>http://programming.sajjad.biz/23/csharp-params-keywords/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 18:00:49 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Keywords]]></category>
		<category><![CDATA[params]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=23</guid>
		<description><![CDATA[using System; namespace ConsoleApplication { class Program { static void Main(string[] args) { if (Containt(typeof(int), new object[] { true, 1, 110.1F, 20L, 80.0001D, "SAJJAD", DateTime.Now })) { Console.WriteLine("Array contain Int32 type !"); } if (Containt(typeof(DateTime), true, 1, 110.1F, 20L, 80.0001D, "SAJJAD", DateTime.Now)) { Console.WriteLine("Array contain Datetime type !"); } Console.ReadLine(); } static bool Containt(Type type, <a href="http://programming.sajjad.biz/23/csharp-params-keywords/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">
using System;

namespace ConsoleApplication
{
	class Program
	{
		static void Main(string[] args)
		{
			if (Containt(typeof(int), new object[] { true, 1, 110.1F, 20L, 80.0001D, "SAJJAD", DateTime.Now }))
			{
				Console.WriteLine("Array contain Int32 type !");
			}

			if (Containt(typeof(DateTime), true, 1, 110.1F, 20L, 80.0001D, "SAJJAD", DateTime.Now))
			{
				Console.WriteLine("Array contain Datetime type !");
			}

			Console.ReadLine();
		}

		static bool Containt(Type type, params object[] list)
		{
			foreach (object obj in list)
				if (obj.GetType() == type)
					return true;

			return false;
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/23/csharp-params-keywords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Abstract, Sealed &amp; Static modifiers in C#</title>
		<link>http://programming.sajjad.biz/21/abstract-sealed-static-modifiers-in-c-sharp/</link>
		<comments>http://programming.sajjad.biz/21/abstract-sealed-static-modifiers-in-c-sharp/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 21:38:11 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[abstract]]></category>
		<category><![CDATA[Guidline]]></category>
		<category><![CDATA[Modifiers]]></category>
		<category><![CDATA[sealed]]></category>
		<category><![CDATA[Static]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=21</guid>
		<description><![CDATA[C# provides many modifiers for use with types and type members. Of these, three can be used with classes: abstract, sealed and static. abstract The abstract modifier indicates that the thing being modified has a missing or incomplete implementation. The abstract modifier can be used with classes, methods, properties, indexers, and events. Use the abstract <a href="http://programming.sajjad.biz/21/abstract-sealed-static-modifiers-in-c-sharp/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>C# provides many modifiers for use with types and type members. Of these, three can be used with classes: abstract, sealed and static.</p>
<p><strong>abstract</strong><br />
The <em>abstract</em> modifier indicates that the thing being modified has a missing or incomplete implementation. The <em>abstract</em> modifier can be used with classes, methods, properties, indexers, and events. Use the <em>abstract</em> modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as <em>abstract</em>, or included in an <em>abstract</em> class, must be implemented by classes that derive from the <em>abstract</em> class</p>
<pre name="code" class="csharp">abstract class A {}
A a = new A(); //Error</pre>
<p><strong>sealed</strong><br />
When applied to a class, the <em>sealed</em> modifier prevents other classes from inheriting from it. In the following example, class B inherits from class A, but no class can inherit from class B.</p>
<pre name="code" class="csharp">sealed class A {}
class B:A {} //Error</pre>
<p><strong>static</strong><br />
The <em>static</em> modifier can be used with classes, fields, methods, properties, operators, events, and constructors, but it cannot be used with indexers, destructors, or types other than classes. The <em>static</em> modifier on a class means that the class cannot be instantiated, and that all of its members are <em>static</em>. A <em>static</em> member has one version regardless of how many instances of its enclosing type are created</p>
<pre name="code" class="csharp">static class A {}
A a = new A(); //Error
/* All member must be static */</pre>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/21/abstract-sealed-static-modifiers-in-c-sharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Reserved and Contextual Keywords</title>
		<link>http://programming.sajjad.biz/20/c-sharp-reserved-and-contextual-keywords/</link>
		<comments>http://programming.sajjad.biz/20/c-sharp-reserved-and-contextual-keywords/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 01:47:44 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Contextual]]></category>
		<category><![CDATA[Keywords]]></category>
		<category><![CDATA[Reserved]]></category>
		<category><![CDATA[Specification]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=20</guid>
		<description><![CDATA[Specification keywords abstract &#124; as &#124; base &#124; bool &#124; break &#124; byte &#124; case &#124; catch &#124; char &#124; checked &#124; class &#124; const &#124; continue &#124; decimal &#124; default &#124; delegate &#124; do &#124; double &#124; else &#124; enum &#124; event &#124; explicit &#124; extern &#124; false &#124; finally &#124; fixed &#124; float <a href="http://programming.sajjad.biz/20/c-sharp-reserved-and-contextual-keywords/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><strong>Specification keywords</strong><br />
abstract | as | base | bool | break | byte | case | catch | char | checked | class | const | continue | decimal | default | delegate | do | double | else | enum | event | explicit | extern | false | finally | fixed | float | for | foreach | goto | if | implicit | in | int | interface | internal | is | lock | long | namespace | new | null | object | operator | out | override | params | private | protected | public | readonly | ref | return | sbyte | sealed | short | sizeof | stackalloc | static | string | struct | switch | this | throw | true | try | typeof | uint | ulong | unchecked | unsafe | ushort | using | virtual | void | volatile | while</p>
<p><strong>Magic keywords</strong><br />
__arglist | __makeref | __reftype | __refvalue</p>
<p><strong>Keywords as an identifier</strong><br />
@typeof @goto = @for.@switch(@throw);</p>
<p><strong>Preprocessor keywords</strong><br />
#define | hidden | default | disable | restore | checksum</p>
<p><strong>C# 1.0 Contextual keywords</strong><br />
get | set | value | add | remove</p>
<p><strong>C# 2.0 Contextual keywords</strong><br />
where | partial | global | yield | alias</p>
<p><strong>C# 3.0 Contextual keywords</strong><br />
from | join | on | equals | into | orderby | ascending | descending | group | by | select | let | var</p>
<p><strong>C# 4.0 Contextual keywords</strong><br />
dynamic</p>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/20/c-sharp-reserved-and-contextual-keywords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# speed: &#8216;return&#8217; vs &#8216;yield return&#8217;</title>
		<link>http://programming.sajjad.biz/18/c-sharp-speed-return-vs-yield-return/</link>
		<comments>http://programming.sajjad.biz/18/c-sharp-speed-return-vs-yield-return/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 17:43:44 +0000</pubDate>
		<dc:creator>SAJJAD</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[IEnumerable]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[T]]></category>
		<category><![CDATA[yield]]></category>

		<guid isPermaLink="false">http://programming.sajjad.biz/?p=18</guid>
		<description><![CDATA[Declare; public static T[] Reserve< T>(T[] array) { T[] newArray = new T[array.Length]; for (i = 0; i < array.Length; i++) newArray[i] = array[array.Length - 1 - i]; return newArray; } public static IEnumerable ReserveAsync< T>(T[] array) { for (i = 0; i < array.Length; i++) yield return array[array.Length - 1 - i]; } Use; <a href="http://programming.sajjad.biz/18/c-sharp-speed-return-vs-yield-return/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><strong>Declare;</strong></p>
<pre name="code" class="csharp">
public static T[] Reserve< T>(T[] array)
{
	T[] newArray = new T[array.Length];

	for (i = 0; i < array.Length; i++)
		newArray[i] = array[array.Length - 1 - i];

	return newArray;
}

public static IEnumerable ReserveAsync< T>(T[] array)
{
	for (i = 0; i < array.Length; i++)
		yield return array[array.Length - 1 - i];
}
</pre>
<p><strong>Use;</strong></p>
<pre name="code" class="csharp">
int[] ii = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

long a;

a = DateTime.Now.Ticks;
foreach (int i in xArray.Reserve(ii))
	Debug.WriteLine(i);
Debug.WriteLine(DateTime.Now.Ticks - a);

a = DateTime.Now.Ticks;
foreach (int i in xArray.ReserveAsync(ii))
	 Debug.WriteLine(i);
Debug.WriteLine(DateTime.Now.Ticks - a);
</pre>
<p><strong>Result;</strong><br />
<strong><em>ReserveAsync</em></strong> often is 60% faster than  <strong><em>Reserve</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://programming.sajjad.biz/18/c-sharp-speed-return-vs-yield-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
