Запись в текстовый файл координат точек - C#
Формулировка задачи:
Здравствуйте.
Начал разбираться с кинектом. требуется запись в текстовый файл координат точек. Однако не могу даже записать в текстовый файл просто циферки 123. Выдает ошибку, что файл используется (Процесс не может получить доступ к файлу "C:\my3dclouds\tpointcloud1.txt", так как этот файл используется другим процессом). Подскажите, где ошибка.
Спасибо.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication8
{
/// <summary>
/// Логика взаимодействия для MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
class WriteTextFile
{
}
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
string pathname = @"C:\my3dclouds\t";
string filename = "pointcloud";
int number = 1;
string fileadd = ".txt";
string fullpath;
fullpath = pathname + filename + number.ToString() + fileadd;
System.IO.File.Create(fullpath);
using (System.IO.StreamWriter file1 = new System.IO.StreamWriter(fullpath))
{
System.Threading.Thread.Sleep(1000);
file1.Write(123);
}
}
}
}Решение задачи: «Запись в текстовый файл координат точек»
textual
Листинг программы
var file = System.IO.File.Create(fullpath); file.Close();