private ChoCodeDomProvider ConstructOperation(object value) { if (_defaultValueCodeSnippet.IsNullOrEmpty()) { return(null); } string[] namespaces = NameSpaces.IsNullOrWhiteSpace() ? null : NameSpaces.SplitNTrim(';'); int opi = this._defaultValueCodeSnippet.IndexOf("=>"); if (opi < 0) { return(null); // throw new Exception("No lambda operator =>"); } string param = this._defaultValueCodeSnippet.Substring(0, opi).NTrim(); if (Language == ChoCodeProviderLanguage.VB) { if (!ChoCodeDomProvider.IsValidVBIdentifier(param)) { throw new ApplicationException("Invalid VB identifier found."); } } else { if (!ChoCodeDomProvider.IsValidCSharpIdentifier(param)) { throw new ApplicationException("Invalid C# identifier found."); } } string codeBlock = this._defaultValueCodeSnippet.Substring(opi + 2).NTrim(); if (!codeBlock.Contains(";") && !codeBlock.StartsWith("return")) { codeBlock = "return {0};".FormatString(codeBlock); } var cd = new ChoCodeDomProvider(new string[] { codeBlock }, namespaces, Language); cd.BuildFunc(param, ParamType == null ? value.GetType() : ParamType); return(cd); }