Question: I want to form a string as `<repeat><daily dayFrequency="10" /></repeat>` 

Wherein the value in `""` comes from a textboxe.g in above string `10`. I formed the string in C# as 

`@"<repeat><daily dayFrequency=""+ txt_daily.Text + "" /></repeat>"` but i get the output as 

`<repeat><daily dayFrequency="+ txt_daily.Text+ " /></repeat>`. How to form a string which includes the input from a textbox and also double quotes to be included in that string.

Answer: 
To insert the value of one string inside another you could consider `string.Format`:

```
string.Format("foo {0} bar", txt_daily.Text)

```

This is more readable than string concatenation.

However I would strongly advise against building the XML string yourself. With your code if the user enters text containing a `<` symbol it will result in invalid XML.

Create the XML using an XML library.

**Related**

* [How can I build XML in C#?](https://stackoverflow.com/questions/284324/what-is-the-best-way-to-build-xml-in-c-sharp-code)
You could do it like this:

```
var str = String.Format(@"<repeat><daily dayFrequency="{0}" /></repeat>",
                        txt_daily.Text);

```

But it would be best to have an object that mapped to this format, and [serialize it to xml](http://support.microsoft.com/kb/815813)