本文整理汇总了C#中System.Text.UTF8Encoding.Count方法的典型用法代码示例。如果您正苦于以下问题:C# UTF8Encoding.Count方法的具体用法?C# UTF8Encoding.Count怎么用?C# UTF8Encoding.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.UTF8Encoding
的用法示例。
在下文中一共展示了UTF8Encoding.Count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateConfigurationFile
public static void CreateConfigurationFile(string configurationPath, string mockBaseDirectory, string configurationContent)
{
Directory.CreateDirectory(mockBaseDirectory);
using (var file = File.Create(Path.Combine(mockBaseDirectory, configurationPath)))
{
var info = new UTF8Encoding(true).GetBytes(configurationContent);
file.Write(info, 0, info.Count());
}
}
示例2: FrenchEncoding
private static void FrenchEncoding()
{
using (var fs = new FileStream(@"c:\frenchcoding\frenchencoding.csv", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
var preamble = new UTF8Encoding(true).GetPreamble();
fs.Write(preamble,0,preamble.Count());
var byteArrayLine1 = System.Text.Encoding.UTF8.GetBytes("courriel, nom, prénom"+Environment.NewLine);
fs.Write(byteArrayLine1, 0, byteArrayLine1.Count());
var byteArrayLine2 = System.Text.Encoding.UTF8.GetBytes("[email protected], Paradis, Pascal");
fs.Write(byteArrayLine2, 0, byteArrayLine2.Count());
}
}
示例3: GetConfigurationDefaults
private ConfigurationDefaults GetConfigurationDefaults(string configurationDefaultsContent)
{
var configurationDefaultsPath = "NuGetDefaults.config";
var mockBaseDirectory = TestFilesystemUtility.CreateRandomTestFolder();
Directory.CreateDirectory(mockBaseDirectory);
using (var file = File.Create(Path.Combine(mockBaseDirectory, configurationDefaultsPath)))
{
var info = new UTF8Encoding(true).GetBytes(configurationDefaultsContent);
file.Write(info, 0, info.Count());
}
return new ConfigurationDefaults(mockBaseDirectory, configurationDefaultsPath);
}