PDA

View Full Version : سوال: چگونه یک متن "چند خطی یا multiline" را درون یک متغیر string ذخیره کنیم ؟



parsa lotfy
جمعه 11 مرداد 1392, 09:24 صبح
دوستان چگونه میتوانیم مثلا کد زیر را درون یک متغیر string a; ذخیره کنیم ؟؟؟

using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Net.NetworkInformation;

namespace WindowsFormsApplication1
{
static class Program
{
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
public class Form1:Form
{





public Form1()
{



MessageBox.Show("salam,man injam :D");



this.Text = "Program";
this.ShowInTaskbar = true;
this.Opacity = 100 ;
this.ControlBox = true;







}



}
}

amir200h
جمعه 11 مرداد 1392, 10:35 صبح
به دو روش
string myString = @"line aval.
line dovom.
line sevom.";

string myString = "line aval.\n" +
"line dovom.\n" +
"line sevom.\n";