Created
April 28, 2011 17:46
-
-
Save fboiton/946852 to your computer and use it in GitHub Desktop.
dictionary from csv string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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