يه تابع ساده واسه اينكه ببينيم ورودي int هست يا نه؟
        #region IsInteger
        ///<summary>
        /// Checks whether the give text is integer.
        ///</summary>
        ///<param name="text">The text to be checked.</param>
        ///<returns>true if text is integer</returns>
        public static bool IsInteger(this string text)
        {
            int num;
            return int.TryParse(text, out num);
        }
        #endregion
يه تابع ساده واسه اينكه ببينيم ورودي int يا كنترلي (مثل enter) هست يا نه؟
        #region IsInetegerOrControl 
        ///<summary> 
        /// Checks whether the give text is one of integer or control, or not.
        ///</summary> 
        /// <param name="text">The text to be checked.</param> 
        /// <returns>true if text is integer or control</returns> 
        public static bool IsInetegerOrControl(this string text)
        {
            int num;
            if (!int.TryParse(text, out num)) return true;
            foreach (char chr in text)
            {
                if (!char.IsControl(chr))
                    return false;
            }
            return true;
        }
        #endregion
از بين بردن فضاهاي خالي تو يه آرايه
        #region Compact 
        ///<summary> ///
        ///  Eleminates all null or nullstrings in string array 
        ///</summary> 
        /// <param name="strings">String array to compact</param> 
        /// <returns>Compacted string array</returns> 
        public static string[] Compact(params string[] strings)
        {
            return strings.Where(item => string.IsNullOrEmpty(item)).ToArray();
        }
        #endregion
آيا ورودي unicode هست؟
        #region IsUnicode
        ///<summary> ///
        ///  Checks whether the given text is unicode or not. 
        /// </summary> 
        /// <param name="str">The text to be checked.</param> 
        /// <returns>returns true if text is unicode.</returns> 
        public static bool IsUnicode(this string str)
        {
            byte[] unicodeBytes = System.Text.Encoding.Unicode.GetBytes(str);
            for (int i = 1; i < unicodeBytes.Length; i += 2) if (unicodeBytes[i] != 0) return true;
            return false;
        }
        #endregion
تبديل به unicode:
        #region ToUnicode 
        ///<summary> 
        /// </summary> 
        /// <param name="str"></param> 
        /// <returns></returns> 
        public static string ToUnicode(this string str)
        {
            return Encoding.Unicode.GetString(Encoding.Unicode.GetByt  es(str));
        }
        #endregion
-- لطفا نكات رو بصورت ماژولوار (هر نكته در يك پست) بهمراه عناوين گويا ارسال نماييد. --
با تشكر 
sinpin