Это код:Почему я не получаю null-исключение, если переменная имеет значение null?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;
using unfreez_wrapper;
using Shell32;
namespace DownloadImages
{
public partial class Form1 : Form
{
string rainMapToRead;
string UrlsPath;
int counter;
UnFreezWrapper uf;
string localFilename;
string stringForSatelliteMapUrls;
string satelliteMapToRead;
List<string> StartTags;
List<string> LastTags;
List<string> Maps;
ExtractImages ei;
public Form1()
{
InitializeComponent();
using (WebClient client = new WebClient())
{
client.DownloadFile("http://www.sat24.com/foreloop.aspx?type=1&continent=europa#",localFilename + "rainMap.html");
client.DownloadFile("http://www.sat24.com/en/eu?ir=true", localFilename + "satelliteMap.html");
}
rainMapToRead = File.ReadAllText(localFilename + "rainMap.html");
satelliteMapToRead = File.ReadAllText(localFilename + "satelliteMap.html");
localFileName был перед путь к директории. Но теперь я не определил его так, что он равен нулю. Но даже когда это null, rainMapToRead не является нулевым, и ему удалось найти и прочитать «rainMap.html»
Я имею в виду, если переменная localFilename имеет значение NULL, где файл был понижен до? C:? D:? В случае, если это нулевое значение по умолчанию?
Использование нуля в результатах конкатенации строк в пустом string.'Console.WriteLine (нуль + "Foo"); '' печатает Foo' –