using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Xml;using System.Text.RegularExpressions;namespace yournamespace.subfoldername{ class DoCheckAlphanueric { public bool chkelementvalueaphanumeric(string yourXMLfile, string yourXPathValue) { bool result = false; XmlDocument doc = new XmlDocument(); doc.Load(yourXMLfile); XmlNodeList myNodeList = doc.SelectNodes(yourXPathValue); foreach (XmlNode myNode in myNodeList) { Regex pattern = new Regex("^[a-zA-Z0-9]*$"); string[] result = myNode.InnerText.Trim().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in result) { if (pattern.IsMatch(s)) { result = true; return result; } else { result = false; } } } return result; } }}