Skip to content

Instantly share code, notes, and snippets.

@fboiton
Created April 28, 2011 17:46
Show Gist options
  • Save fboiton/946852 to your computer and use it in GitHub Desktop.
Save fboiton/946852 to your computer and use it in GitHub Desktop.
dictionary from csv string
public interface IXmlToDictionary<T,TK>
{
T this[TK key] { get; }
}
public class DynamicTransformationParams : IXmlToDictionary<string,string>
{
private readonly string _keyValueText;
public string this[string key]
{
get
{
return GetValueFromKey(key);
}
}
private string GetValueFromKey(key){
var test = RegExp(.......
//TODO: IMPLEMENT MATCH
// SAMPLE : http://www.dotnetperls.com/regex-match
string input = "/content/alternate-1.aspx";
// Here we call Regex.Match.
Match match = Regex.Match(input, @"content/([A-Za-z0-9\-]+)\.aspx$",
RegexOptions.IgnoreCase);
// Here we check the Match instance.
if (match.Success)
{
// Finally, we get the Group value and display it.
string key = match.Groups[1].Value;
Console.WriteLine(key);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment