일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- algorithm
- convert
- tls
- ListView
- commit
- Github
- mysql
- Process
- git
- csharp
- nullable
- chashtag
- .net
- coding-test
- dotNET
- windows
- File
- logging
- C#
- 코딩테스트
- Visual Studio
- WPF
- Coding
- Binding
- string
- programmers
- IValueConverter
- Microsoft
- log
- windows10
Archives
- Today
- Total
CHashtag
[C#] 파일 읽기, 저장하기 (UTF8) 본문
반응형
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CHashtag
{
class FileIO
{
static void Main(string[] args)
{
string inputFilePath = @"c:\temp\input.txt";
string outputFilePath = @"c:\temp\output.txt";
var inputArr = File.ReadAllLines(inputFilePath, Encoding.UTF8);
// change array to list
var inputList = new List<string>(inputArr);
List<string> outputList = new List<string>();
inputList.ForEach(x => outputList.Add(string.Format("[Success] {0}", x)));
File.WriteAllLines(outputFilePath, outputList, Encoding.UTF8);
}
}
}
반응형
'C#' 카테고리의 다른 글
[C#] 다른 프로세스가 파일 사용중인지 확인하기 (Check File Lock) (0) | 2021.02.08 |
---|---|
[C#] 압축, 압축 풀기 (zip, unzip) (2) | 2021.02.05 |
[C#] 현재 메소드 이름 얻기 ( MethodBase.GetCurrentMethod() ) (0) | 2021.01.11 |
[ZOOM] [C#] [SDK] 2. C# Wrapper SDK 다운로드 & 프로젝트에 적용 (0) | 2020.11.21 |
[C#] Collection for 값 변경시 System.InvalidOperationException 해결법 (0) | 2020.10.26 |