[xbuild] Expression.ParseAs<T> - new method
authorAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 14:30:54 +0000 (20:00 +0530)
committerAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 19:20:30 +0000 (00:50 +0530)
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Expression.cs

index bbda1ac7da31ff8a8eea86d729561fb0cb28a02a..0d7ad2fa5984896fe57d3b622bc8b6ceefddab82 100644 (file)
@@ -66,6 +66,20 @@ namespace Microsoft.Build.BuildEngine {
                        this.expressionCollection = new ExpressionCollection ();
                }
 
+               public static T ParseAs<T> (string expression, ParseOptions options, Project project)
+               {
+                       Expression expr = new Expression ();
+                       expr.Parse (expression, options);
+                       return (T)expr.ConvertTo (project, typeof (T));
+               }
+
+               public static T ParseAs<T> (string expression, ParseOptions options, Project project, ExpressionOptions exprOptions)
+               {
+                       Expression expr = new Expression ();
+                       expr.Parse (expression, options);
+                       return (T)expr.ConvertTo (project, typeof (T), exprOptions);
+               }
+
                // Split: Split on ';'
                //         Eg. Property values don't need to be split
                //