本文整理匯總了C#中System.Text.StringBuilder.PrependLine方法的典型用法代碼示例。如果您正苦於以下問題:C# StringBuilder.PrependLine方法的具體用法?C# StringBuilder.PrependLine怎麽用?C# StringBuilder.PrependLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Text.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.PrependLine方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ToFeatureDescription
public static string ToFeatureDescription(this List<Feature> features)
{
var featureDescription = new StringBuilder();
var garden = features.GardenOrDefault();
if (garden.IsNotNull() && garden.ToGardenDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {garden.ToGardenDescription()}");
var parking = features.ParkingOrDefault();
if (parking.IsNotNull() && parking.ToParkingDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {parking.ToParkingDescription()}");
var whitegoods = features.WhiteGoodsOrDefault();
if (whitegoods.IsNotNull() && whitegoods.ToWhiteGoodsDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {whitegoods.ToWhiteGoodsDescription()}");
var furnishing = features.FurnishingOrDefault();
if (furnishing.IsNotNull() && furnishing.ToFurnishingDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {furnishing.ToFurnishingDescription()}");
var pets = features.PetsOrDefault();
if (pets.IsNotNull() && pets.ToPetsDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {pets.ToPetsDescription()}");
var decoration = features.DecorativeConditionOrDefault();
if (decoration.IsNotNull() && decoration.ToDecorativeDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {decoration.ToDecorativeDescription()}");
var glazing = features.GlazingOrDefault();
if (glazing.IsNotNull() && glazing.ToGlazingDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {glazing.ToGlazingDescription()}");
var heating = features.HeatingOrDefault();
if (heating.IsNotNull() && heating.ToHeatingDescription().IsNotNullOrEmpty())
featureDescription.AppendLine($"- {heating.ToHeatingDescription()}");
if (featureDescription.Length > 0)
{
featureDescription.PrependLine("The property benefits from the following features:");
}
return featureDescription.ToString();
}
示例2: ToAmenityDescription
public static string ToAmenityDescription(this List<Amenity> amenities)
{
var amenityDescription = new StringBuilder();
var shopping = amenities.ShoppingOrDefault();
if (shopping.IsNotNull() && shopping.ToShoppingDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {shopping.ToShoppingDescription()}");
var restauarants = amenities.RestaurantsOrDefault();
if (restauarants.IsNotNull() && restauarants.ToRestaurantsDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {restauarants.ToRestaurantsDescription()}");
var bars = amenities.BarsOrDefault();
if (bars.IsNotNull() && bars.ToBarsDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {bars.ToBarsDescription()}");
var cafes = amenities.CafesOrDefault();
if (cafes.IsNotNull() && cafes.ToCafesDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {cafes.ToCafesDescription()}");
var trains = amenities.TrainStationOrDefault();
if (trains.IsNotNull() && trains.ToTrainDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {trains.ToTrainDescription()}");
var buses = amenities.BusStopOrDefault();
if (buses.IsNotNull() && buses.ToBusDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {buses.ToBusDescription()}");
var schools = amenities.SchoolsOrDefault();
if (schools.IsNotNull() && schools.ToSchoolDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {schools.ToSchoolDescription()}");
var parks = amenities.ParksOrDefault();
if (parks.IsNotNull() && parks.ToParkDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {parks.ToParkDescription()}");
var publicTransport = amenities.PublicTransportOrDefault();
if (publicTransport.IsNotNull() && publicTransport.ToPublicTransportDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {publicTransport.ToPublicTransportDescription()}");
var beaches = amenities.BeachesOrDefault();
if (beaches.IsNotNull() && beaches.ToBeachesDescription().IsNotNullOrEmpty())
amenityDescription.AppendLine($"- {beaches.ToBeachesDescription()}");
if (amenityDescription.Length > 0)
{
amenityDescription.PrependLine("The property is located near to the following amenities:");
}
return amenityDescription.ToString();
}