如何将静态html放在c#的字符串中?

Amb*_*erg 1 c# escaping visual-studio

我是否需要完成整个事情(见下文)并将其转换为将其放入字符串中?(使用c#,vs 2010,控制台应用)

<link rel="stylesheet" href="_layouts/jquery/global.css">
<script type="text/javascript" src="_layouts/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="_layouts/jQuery/slides.min.jquery.js"></script>
<script>
    $(function(){
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true,
            animationStart: function(current){
                $('.caption').animate({
                    bottom:-50
                },100);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationStart on slide: ', current);
                };
            },
            animationComplete: function(current){
                $('.caption').animate({
                    bottom:0
                },200);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationComplete on slide: ', current);
                };
            },
            slidesLoaded: function() {
                $('.caption').animate({
                    bottom:0
                },200);
            }
        });
    });
</script>

    <div id="container">
        <div id="example">
            <img src="img/new-ribbon.png" width="112" height="112" alt="New Ribbon" id="ribbon">
            <div id="slides">
                <div class="slides_container">
Run Code Online (Sandbox Code Playgroud)

Jon*_*eet 5

如果你有大量的文本要放在一个字符串中,我就不会硬编码到源代码中.可以将其包含在可以从磁盘加载的文件中,也可以将其包含在嵌入式资源中并加载Assembly.GetManifestResourceStream.这样就不需要转义,你可以在你最喜欢的编辑器中使用语法高亮,而你的C#代码仍然用C#代替HTML.