本文整理汇总了C#中ScriptCoreLib.ToAnonymousConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.ToAnonymousConstructor方法的具体用法?C# ScriptCoreLib.ToAnonymousConstructor怎么用?C# ScriptCoreLib.ToAnonymousConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib
的用法示例。
在下文中一共展示了ScriptCoreLib.ToAnonymousConstructor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPirateBay
private static void ShowPirateBay()
{
Console.WriteLine("<style>");
Console.WriteLine("img { border: 0; }");
//Console.WriteLine("ol { -moz-column-count: 2; }");
Console.WriteLine(@"
embed {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 0;
}
ol
{
display: block;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 1;
overflow: scroll;
}
li
{
color: white;
cursor:hand;
}
body{
text-align: center;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:.7em;
margin: 10px;
color: #fff;
background: #fff;
min-width: 520px;
overflow: hidden;
}
a{
color: #009;
text-decoration: none;
border-bottom: 1px dotted #4040D9;
}
a:hover{
text-decoration: none;
border-bottom: 1px solid #009;
}
li {
text-align: left;
margin: 1em;}
");
Console.WriteLine("</style>");
var DefaultLink = new { Link = "", Title = "", Text = "" };
var DefaultImage = new { Source = "", Alt = "", Title = "" };
var ParseLink = DefaultLink.ToAnonymousConstructor(
(string element) =>
{
var Link = "";
var Title = "";
var Text = "";
element.
ParseAttribute("href", value => Link = value).
ParseAttribute("title", value => Title = value).
ParseContent(value => Text = value).
Parse();
return new { Link, Title, Text };
}
);
var ParseImage = DefaultImage.ToAnonymousConstructor(
(string element) =>
{
var Source = "";
var Alt = "";
var Title = "";
element.
ParseAttribute("src", value => Source = value).
ParseAttribute("alt", value => Alt = value).
ParseAttribute("title", value => Title = value).
ParseContent(null).
Parse();
return new { Source, Alt, Title };
}
);
//.........这里部分代码省略.........