如何声明带有我的名字的char变量?

时间:2019-02-16 09:58:37

标签: c#

我不知道是否只能用一个变量声明它。我是乞gg。

$("#checkin").datepicker({
        format: 'yyyy-mm-dd',
        todayHighlight: true,
        autoclose: true,
        onSelect: function(ev) {
            var fromDate = $('#checkin').datepicker("getDate");
            var rangemindate = new Date(fromDate.getFullYear(), fromDate.getMonth(),fromDate.getDate() + 1);
            var rangemaxdate = new Date(fromDate.getFullYear(), fromDate.getMonth(),fromDate.getDate() + 30); 
            $("#checkout").datepicker({
                format: 'yyyy-mm-dd',
                todayHighlight: true,
                autoclose: true,
                minDate: rangemindate,
                maxDate: rangemaxdate
            });
        }
    });

对吗?

2 个答案:

答案 0 :(得分:0)

C#中的 string 声明如下: 使用系统;

namespace StringApplication {

   class Program {

      static void Main(string[] args) {
         //from string literal and string concatenation
         string fname, lname;
         fname = "Rowan";
         lname = "Atkinson";

         char []letters= { 'H', 'e', 'l', 'l','o' };
         string [] sarray={ "Hello", "From", "Tutorials", "Point" };

         string fullname = fname + lname;
         Console.WriteLine("Full Name: {0}", fullname);

         //by using string constructor { 'H', 'e', 'l', 'l','o' };
         string greetings = new string(letters);
         Console.WriteLine("Greetings: {0}", greetings);

         //methods returning string { "Hello", "From", "Tutorials", "Point" };
         string message = String.Join(" ", sarray);
         Console.WriteLine("Message: {0}", message);

         //formatting method to convert a value
         DateTime waiting = new DateTime(2012, 10, 10, 17, 58, 1);
         string chat = String.Format("Message sent at {0:t} on {0:D}", waiting);
         Console.WriteLine("Message: {0}", chat);
      }
   }
}

它产生的输出

Full Name: RowanAtkinson
Greetings: Hello
Message: Hello From Tutorials Point
Message: Message sent at 5:58 PM on Wednesday, October 10, 2012

答案 1 :(得分:0)

如果要在char中命名,则将其声明为字符数组。

char []a= { 'H', 'e', 'l', 'l','o' };