我有大量的代碼在Visual Studio中編譯,但是在不同的IDE中它不能編譯。編譯錯誤c#
返回的錯誤是System.IO文件不包含「ReadLines」的定義。
我使用system.io
與一個eror出現的代碼的部分是readlines方法。
有人可以提供靈魂嗎?
using System;
using System.IO; // enable the user of different sections of the .net framework
using System.Linq;
using System.Collections.Generic;
namespace HashTagAssignment
{
class HashTag
{
static void Main(string[] args)
{
string tweets = File.ReadAllText(@"F:\tweets.txt"); // Retrives Text from file and loads into console
{
Console.WriteLine(tweets); // writes contense to console
{
var lineCount = File.ReadAllLines(@"F:\tweets.txt").Length; // counts number of lines in the whole document
Console.WriteLine("Number of Lines:{0}", lineCount); // displays answer
{
var result = File.ReadLines(@"F:\tweets.txt").Distinct().Count(); // search txt file for Distinct enteries and implement counter.
Console.WriteLine(" Number of Unique Tags: {0}", result); // display result of counter
{
Console.WriteLine(" Top Twenty By Number:"); // Title Top twenty hash tags, with order they occured in left colum.
Console.WriteLine(); // creates a line space
var rank = File // assigns varible to a file
.ReadLines(@"F:\tweets.txt") // directs to file, in this case text
.GroupBy(x => x)
.Select(g => new { Key = g.Key, Count = g.Count() })
.OrderByDescending(i => i.Count)
.Take(20);
foreach (var item in rank)
{
Console.WriteLine("{0} {1}", item.Count, item.Key);
}
{
{
}
Console.ReadKey(true);
}
}
}
}
}
}
}
}
後喲代碼喲。 –
讓我們看看代碼和錯誤? –
我們是否想要猜測其他IDE?也許你試圖在Netbeans中編譯你的C#程序。 –