11using System ;
2+ using System . Linq ;
3+ using System . Threading . Tasks ;
24
35namespace ColorCode . BasicTests
46{
57 internal class Program
68 {
79 private static void Main ( string [ ] args )
810 {
9- var csharpstring = "public void Method()\n {\n }" ;
10- var formatter = new HtmlClassFormatter ( ) ;
11- var html = formatter . GetHtmlString ( csharpstring , Languages . CSharp ) ;
12- var css = formatter . GetCSSString ( ) ;
11+ if ( args . Contains ( "--concurrent" ) )
12+ {
13+ var tasks = new Task [ 100 ] ;
14+ for ( int i = 0 ; i < 100 ; i ++ )
15+ {
16+ tasks [ i ] = Task . Run ( ( ) =>
17+ {
18+ var code = "public void Method()\n {\n }" ;
19+ var formatter = new HtmlFormatter ( ) ;
20+ var html = formatter . GetHtmlString ( code , Languages . CSharp ) ;
21+ Console . WriteLine ( html ) ;
22+ } ) ;
23+ }
24+ Task . WaitAll ( tasks ) ;
25+ }
26+ else
27+ {
28+ var csharpstring = "public void Method()\n {\n }" ;
29+ var formatter = new HtmlClassFormatter ( ) ;
30+ var html = formatter . GetHtmlString ( csharpstring , Languages . CSharp ) ;
31+ var css = formatter . GetCSSString ( ) ;
1332
14- Console . WriteLine ( "Original:" ) ;
15- Console . WriteLine ( csharpstring ) ;
33+ Console . WriteLine ( "Original:" ) ;
34+ Console . WriteLine ( csharpstring ) ;
1635
17- Console . WriteLine ( "HTML:" ) ;
18- Console . WriteLine ( html ) ;
36+ Console . WriteLine ( "HTML:" ) ;
37+ Console . WriteLine ( html ) ;
1938
20- Console . ReadKey ( ) ;
39+ Console . ReadKey ( ) ;
40+ }
2141 }
2242 }
2343}
0 commit comments