本文整理汇总了C#中System.Text.StringBuilder.AppendLine方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AppendLine方法的具体用法?C# StringBuilder.AppendLine怎么用?C# StringBuilder.AppendLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.AppendLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
public override string ToString()
{
if (PageCount == 1)
return "";
var sb = new StringBuilder(512);
sb.Append(@"<div class=""");
sb.Append(CssClass);
sb.Append(@""">");
foreach (int pageSize in PageSizes)
{
sb.Append(@"<a href=""");
sb.Append(HRef.Replace("pagesize=-1", "pagesize=" + pageSize));
sb.Append(@""" title=""");
sb.Append("show ");
sb.Append(pageSize);
sb.Append(@" items per page""");
if (pageSize == CurrentPageSize)
sb.Append(@" class=""current page-numbers""");
else
sb.Append(@" class=""page-numbers""");
sb.Append(">");
sb.Append(pageSize);
sb.AppendLine("</a>");
}
sb.AppendLine(@"<span class=""page-numbers desc"">per page</span>");
sb.Append("</div>");
return sb.ToString();
}
示例2: GetInfo
public override string GetInfo()
{
var builder = new StringBuilder();
builder.AppendLine("Auto balancing landing Leg");
builder.AppendLine("By KerboKatz");
return builder.ToString();
}
示例3: AppendCustomInfo
/// <summary>
/// Appends "Exit after stopping" or "Stopping"
/// </summary>
/// <param name="customInfo">The autopilot block's custom info</param>
public override void AppendCustomInfo(StringBuilder customInfo)
{
if (m_exitAfter)
customInfo.AppendLine("Exit after stopping");
else
customInfo.AppendLine("Stopping");
}
示例4: GenerateSrcFiles
public static string GenerateSrcFiles(string text, List<FileInfo> srcFiles, DirectoryInfo projectPath, string dirPrefix)
{
const string begin = "#BEGIN_AUTO_GENERATE_SRC_FILES";
const string end = "#END_AUTO_GENERATE_SRC_FILES";
int beginIndex = text.IndexOf(begin) + begin.Length;
int endIndex = text.IndexOf(end);
text = text.Remove(beginIndex, endIndex - beginIndex);
StringBuilder result = new StringBuilder();
result.AppendLine();
result.AppendLine(@"LOCAL_SRC_FILES :=\");
int i = srcFiles.Count;
foreach (var fileInfo in srcFiles)
{
--i;
string fileName = dirPrefix + fileInfo.FullName.Replace(projectPath.FullName, string.Empty).Remove(0, 1);
fileName = fileName.Replace('\\', '/');
if (i!=0)
{
fileName += " \\";
}
result.AppendLine(fileName);
}
text = text.Insert(beginIndex, result.ToString());
return text;
}
示例5: Introduce
internal override string Introduce()
{
StringBuilder info = new StringBuilder();
info.AppendLine("Boy: ");
info.AppendLine(base.Introduce());
return info.ToString();
}
示例6: FormatSql
/// <summary>
/// Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top.
/// </summary>
public string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
{
StringBuilder buffer = new StringBuilder();
if (command != null && IncludeMetaData)
{
buffer.AppendLine("-- Command Type: " + command.CommandType);
buffer.AppendLine("-- Database: " + command.Connection.Database);
if (command.Transaction != null)
{
buffer.AppendLine("-- Command Transaction Iso Level: " + command.Transaction.IsolationLevel);
}
if (Transaction.Current != null)
{
// transactions issued by TransactionScope are not bound to the database command but exists globally
buffer.AppendLine("-- Transaction Scope Iso Level: " + Transaction.Current.IsolationLevel);
}
buffer.AppendLine();
}
string baseOutput = base.FormatSql(commandText, parameters, command);
buffer.Append(baseOutput);
return buffer.ToString();
}
示例7: Dump
public string Dump()
{
if (Results.Count == 0)
{
return "Overload resolution failed because there were no candidate operators.";
}
var sb = new StringBuilder();
if (this.Best.HasValue)
{
sb.AppendLine("Overload resolution succeeded and chose " + this.Best.Signature.ToString());
}
else if (CountKind(OperatorAnalysisResultKind.Applicable) > 1)
{
sb.AppendLine("Overload resolution failed because of ambiguous possible best operators.");
}
else
{
sb.AppendLine("Overload resolution failed because no operator was applicable.");
}
sb.AppendLine("Detailed results:");
foreach (var result in Results)
{
sb.AppendFormat("operator: {0} reason: {1}\n", result.Signature.ToString(), result.Kind.ToString());
}
return sb.ToString();
}
示例8: BuildViewResult
protected override void BuildViewResult(StringBuilder viewResult)
{
var bookings = this.Model as IEnumerable<Booking>;
if (!bookings.Any())
{
viewResult.AppendLine("There are no bookings for this room.");
}
else
{
viewResult.AppendLine("Room bookings:");
}
foreach (var booking in bookings)
{
viewResult.AppendFormat(
"* {0:dd.MM.yyyy} - {1:dd.MM.yyyy} (${2:F2})",
booking.StartBookDate,
booking.EndBookDate,
booking.TotalPrice).AppendLine();
viewResult.AppendFormat(
"Total booking price: ${0:F2}",
bookings.Sum(b => b.TotalPrice)).AppendLine();
}
}
示例9: ToString
public override string ToString()
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine(this.Name);
stringBuilder.AppendLine(string.Join(", ", this.Ingredients));
return stringBuilder.ToString();
}
示例10: WriteRSAParamsToFile
public void WriteRSAParamsToFile(string file)
{
using (var sw = new StreamWriter(new FileStream(file, FileMode.Append, FileAccess.Write)))
{
var sb = new StringBuilder();
sb.AppendLine("class RsaStore");
sb.AppendLine("{");
// Write all private & public rsa parameters.
WritePublicByteArray(ref sb, "D", RsaParams.D);
WritePublicByteArray(ref sb, "DP", RsaParams.DP);
WritePublicByteArray(ref sb, "DQ", RsaParams.DQ);
WritePublicByteArray(ref sb, "Exponent", RsaParams.Exponent);
WritePublicByteArray(ref sb, "InverseQ", RsaParams.InverseQ);
WritePublicByteArray(ref sb, "Modulus", RsaParams.Modulus);
WritePublicByteArray(ref sb, "P", RsaParams.P);
WritePublicByteArray(ref sb, "Q", RsaParams.Q);
sb.AppendLine("}");
sw.WriteLine(sb.ToString());
}
// Reset all values
RsaParams = new RSAParameters();
}
示例11: ToString
public override void ToString(StringBuilder builder)
{
builder.AppendFormatLine("Items: {0} (displayed: {1})", TotalItemCount, Items.Length);
builder.AppendLine();
foreach (var item in Items)
{
builder.AppendFormatLine("Auction Id: {0} Item Entry: {1}", item.AuctionId, item.ItemEntry);
for (uint i = 0; i < item.Enchantments.Length; ++i)
{
var ench = item.Enchantments[i];
if (ench.Id != 0)
builder.AppendFormatLine(" Enchantment {0}: {1}", i, ench);
}
builder.AppendFormatLine("Property: {0} RandomSuffix: {1} Unknown: {2}",
item.PropertyId, item.SuffixFactor, item.Unknown);
builder.AppendFormatLine("Stack Count: {0} Charges: {1}", item.Count, item.SpellCharges);
builder.AppendLine("Owner: " + item.Owner);
builder.AppendFormatLine("Start Bid: {0} Minimum Bid: {1} BuyOut: {2}",
item.StartBid, item.MinimumBid, item.BuyOut);
builder.AppendLine("Time Left: " + item.TimeLeftMs);
builder.AppendFormatLine("Current Bid: {0} Bidder: {1}", item.CurrentBid, item.CurrentBidder);
builder.AppendLine();
}
builder.AppendLine("Delay: " + NextSearchDelayMs);
}
示例12: Parse
public static Dictionary<string, string> Parse(string dataSource)
{
SortedList<string, SortedSet<string>> allCounters = PdhUtils.Parse(dataSource);
var generated = new Dictionary<string, string>();
foreach (string counterSet in allCounters.Keys)
{
string setName = NameUtils.CreateIdentifier(counterSet);
var sb = new StringBuilder("// This code was generated by EtwEventTypeGen");
sb.AppendLine(setName);
sb.Append("namespace Tx.Windows.Counters.");
sb.AppendLine(setName);
sb.AppendLine();
sb.AppendLine("{");
foreach (string counter in allCounters[counterSet])
{
EmitCounter(counterSet, counter, ref sb);
}
sb.AppendLine("}");
generated.Add(setName, sb.ToString());
}
return generated;
}
示例13: AssertValid
internal static void AssertValid(this DbDatabaseMapping databaseMapping, bool shouldThrow)
{
var storageItemMappingCollection = databaseMapping.ToStorageMappingItemCollection();
var errors = new List<EdmSchemaError>();
storageItemMappingCollection.GenerateViews(errors);
if (errors.Any())
{
var errorMessage = new StringBuilder();
errorMessage.AppendLine();
foreach (var error in errors)
{
errorMessage.AppendLine(error.ToString());
}
if (shouldThrow)
{
throw new MappingException(errorMessage.ToString());
}
Assert.True(false, errorMessage.ToString());
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
ContentNavigation content = new ContentNavigation();
DataSet data = new DataSet();
string[] Vector = new string[6 + 1];
System.Text.StringBuilder sb = new System.Text.StringBuilder();
data = content.getAllContent(Convert.ToInt32(Session["siteId"]));
foreach (DataTable table in data.Tables)
{
foreach (DataRow row in table.Rows)
{
string link = "<a href= CMS_MainSite.aspx?GroupId=" + Convert.ToInt32(row["ContId"]) + ">" + Convert.ToString(row["ContTitle"]) + "</a>";
Vector[Convert.ToInt32(row["ContOrdPos"])] = link;
}
}
for (int i = 1; i < Vector.Length; i++)
{
sb.AppendLine(Convert.ToString(Vector[i]));
}
sb.AppendLine("<hr /> <br/>");
div_Group_Selector.InnerHtml = sb.ToString();
}
示例15: DebugIsValid
protected override void DebugIsValid(StringBuilder sb)
{
if (this.Items == null) return;
sb.AppendLine($"# Invalid Bulk items:");
foreach(var i in Items.Select((item, i) => new { item, i}).Where(i=>!i.item.IsValid))
sb.AppendLine($" operation[{i.i}]: {i.item}");
}