小编Sne*_*rdd的帖子

C#字符串大于或等于代码字符串

//你好,我试图让我的代码工作我的比较如果字符串更大或小于10,但它无法正常工作.即使该值小于10,它也会写入10或更多.

int result = string1.CompareTo("10");
if (result < 0)
{
     Console.WriteLine("less than 10");
}
else if (result >= 0)
{
     Console.WriteLine("10 or more");
} 
Run Code Online (Sandbox Code Playgroud)

c# string string-comparison

5
推荐指数
1
解决办法
3万
查看次数

如何从字符串中读取?

我正在尝试学习如何根据用户选择的时间来安排图片.

这是带有问题的代码:

private void startjob()
{
     string theDate = DateTimePicker1.Value.ToString();
     DateTime dt = Convert.ToDateTime(date);
     {
         DateTime start = new DateTime(2009, 12, 9, 10, 0, 0); //How Do I make this to read the string that is converted from DateTimePicker instead of this?
         DateTime end = new DateTime(2009, 12, 10, 12, 0, 0); //How Do I make this to read the string that is converted from DateTimePicker instead of this?
         DateTime now = DateTime.Now;
         if ((now > start) && (now < …
Run Code Online (Sandbox Code Playgroud)

c# methods datetime function datetimepicker

0
推荐指数
1
解决办法
92
查看次数