• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Culture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Culture的典型用法代码示例。如果您正苦于以下问题:C# Culture类的具体用法?C# Culture怎么用?C# Culture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Culture类属于命名空间,在下文中一共展示了Culture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TimeToString

 public static string TimeToString(TimeSpan timeSpan, Culture culture)
 {
     string s = "";
     switch (culture)
     {
         case Culture.Ru:
             s += ValueToString(timeSpan.Days, "дней", "день", "дня");
             s += " " + ValueToString(timeSpan.Hours, "часов", "час", "часа");
             s = s.Trim();
             s += " " + ValueToString(timeSpan.Minutes, "минут", "минута", "минуты");
             s = s.Trim();
             s += " " + ValueToString(timeSpan.Seconds, "секунд", "секунда", "секунды");
             s = s.Trim();
             break;
         default:
             s += ValueToString(timeSpan.Days, "day", "days");
             s += " " + ValueToString(timeSpan.Hours, "hour", "hours");
             s = s.Trim();
             s += " " + ValueToString(timeSpan.Minutes, "minute", "minutes");
             s = s.Trim();
             s += " " + ValueToString(timeSpan.Seconds, "second", "seconds");
             s = s.Trim();
             break;
     }
     return s;
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:26,代码来源:NumberTranslator.cs


示例2: ExtendedSearch

 public static ExtendedSearch ExtendedSearch(ExtendedSearch search, out int? max, Culture culture)
 {
     max = 0;
     if (search == null)
         return new ExtendedSearch(culture);
     if (!search.NeedToSearch)
         return search;
     int? type = search.CurrentPlaceType;
     if (type == -1)
         type = null;
     switch (search.CurrentSearchItem)
     {
         case (int)SearchItem.Region:
             Country country;
             search.Regions = DataManager.Regions.GetRegions(null, search.Page, ItemsPerPage, out max, out country, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         case (int)SearchItem.Place:
             Region region;
             search.Places = DataManager.Places.GetPlaces(null, search.Page, ItemsPerPage, out max, out region, culture, search.Name, type, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         case (int)SearchItem.Route:
             search.Routes = DataManager.Routes.GetPublicRoutes(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         default:
             search.Countries = DataManager.Countries.GetCountries(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
     }
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:28,代码来源:Manager.cs


示例3: SRegion

 public SRegion(HttpContextBase context, Region region, Culture culture = Culture.En)
 {
     Id = region.Id;
     Name = region.GetName(culture);
     Rating = region.Rating;
     Image = DefineImagePath(context, region.Image);
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:7,代码来源:SRegion.cs


示例4: BtnSave_Click

    protected void BtnSave_Click(object sender, EventArgs e)
    {
        LblErr.Text = "";
        LblOk.Text = "";

        try
        {
            Culture o1 = new Culture();
            if (base.CurrentKey == "")
            {
                form2obj(o1);
                o1 = new CulturesManager().Insert(o1);
            }
            else
            {
                o1 = new CulturesManager().GetByKey(base.CurrentKey);  //precarico i campi esistenti e nn gestiti dal form
                form2obj(o1);
                new CulturesManager().Update(o1);
            }
            Grid1.DataBind();
            LblOk.Text = Utility.GetLabel("RECORD_SAVED_MSG");
            MultiView1.ActiveViewIndex = 0;
        }
        catch (Exception e1)
        {
            LblErr.Text = Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString();
        }
        finally
        {
        }
    }
开发者ID:liqueflies,项目名称:pigeoncms,代码行数:31,代码来源:Default.ascx.cs


示例5: SCountry

 private SCountry(HttpContextBase context, Country country, Culture culture = Culture.En)
 {
     Id = country.Id;
     Name = country.GetName(culture);
     Image = DefineImagePath(context, country.Image);
     Rating = country.Rating;
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:7,代码来源:SCountry.cs


示例6: ChangeCulture

 public ActionResult ChangeCulture(Culture lang, string returnUrl)
 {
     if (returnUrl.Length >= 3)
     {
         returnUrl = returnUrl.Substring(3);
     }
     return Redirect("/" + lang.ToString() + returnUrl);
 }
开发者ID:riseandcode,项目名称:FxGraphsRepository,代码行数:8,代码来源:AccountController.cs


示例7: GetCultureName_Returns_Valid_Result

        public void GetCultureName_Returns_Valid_Result(Culture culture, string cultureName, int cultureLcid)
        {
            string name = null;

            Assert.That(() => name = culture.GetCultureName(), Throws.Nothing);
            Assert.That(name, Is.Not.Null);
            Assert.That(name, Is.EqualTo(cultureName));
        }
开发者ID:akordowski,项目名称:NToolbox,代码行数:8,代码来源:CultureExtensionTest.cs


示例8: SRouteExtended

 public SRouteExtended(Route route, IEnumerable<SCheckPoint> checkPoints, Culture culture)
     : base(route, checkPoints, culture)
 {
     NumberOfCheckPoints = route.CheckPoints.Count;
     AverageTime = route.AverageTime;
     AverageTimeFormatted = route.FormatAverageTime(culture);
     AuthorName = route.User.FullName;
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:8,代码来源:SRoute.cs


示例9: SPlaceExtended

 public SPlaceExtended(HttpContextBase context, Place place, Culture culture = Culture.En)
     : base(context, place, culture)
 {
     Type = PlaceTypes.GetPlaceType(place.TypeId).GetName(culture);
     Description = place.GetDescription(culture);
     RegionId = place.RegionId;
     RegionName = place.Region.GetName(culture);
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:8,代码来源:SPlace.cs


示例10: GetAll

 public static IEnumerable<Status> GetAll(Culture culture)
 {
     return new[]
     {
         Hidden,
         Private,
         Public
     };
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:9,代码来源:Route.Extensions.cs


示例11: SPlace

 public SPlace(HttpContextBase context, Place place, Culture culture = Culture.En)
 {
     Id = place.Id;
     Name = place.GetName(culture);
     Rating = place.Rating;
     X = place.X;
     Y = place.Y;
     Image = DefineImagePath(context, place.Image);
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:9,代码来源:SPlace.cs


示例12: SRoute

 public SRoute(Route route, IEnumerable<SCheckPoint> checkPoints, Culture culture)
 {
     Id = route.Id;
     Name = route.GetName(culture);
     Rating = route.RelativeRating;
     AuthorId = route.Author;
     Status = RouteStatus.GetStatus(route.Status).GetName(culture);
     CheckPoints = checkPoints;
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:9,代码来源:SRoute.cs


示例13: GetAll

 public static IEnumerable<Status> GetAll(Culture culture)
 {
     return new[]
     {
         Default,
         Name,
         Popularity
     };
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:9,代码来源:SearchOrder.cs


示例14: GetCultureInfo_Returns_Valid_Result

        public void GetCultureInfo_Returns_Valid_Result(Culture culture, string cultureName, int cultureLcid)
        {
            CultureInfo cultureInfo = null;

            Assert.That(() => cultureInfo = culture.GetCultureInfo(), Throws.Nothing);
            Assert.That(cultureInfo, Is.Not.Null);
            Assert.That(cultureInfo.LCID, Is.EqualTo(cultureLcid));
            Assert.That(cultureInfo.Name, Is.EqualTo(cultureName));
        }
开发者ID:akordowski,项目名称:NToolbox,代码行数:9,代码来源:CultureExtensionTest.cs


示例15: OrderAscending

 public static IEnumerable<Country> OrderAscending(IEnumerable<Country> countries, Culture culture)
 {
     switch (culture)
     {
         case Culture.Ru:
             return countries.OrderBy(x => x.Translation.Ru);
         default:
             return countries.OrderBy(x => x.Translation.En);
     }
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:10,代码来源:Country.Extensions.cs


示例16: PlacesToString

 public static string PlacesToString(int placesCount, Culture culture)
 {
     switch (culture)
     {
         case Culture.Ru:
             return ValueToString(placesCount, "мест", "место", "места");
         default:
             return ValueToString(placesCount, "place", "places");
     }
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:10,代码来源:NumberTranslator.cs


示例17: CommentsToString

 public static string CommentsToString(int commentsCount, Culture culture)
 {
     switch (culture)
     {
         case Culture.Ru:
             return ValueToString(commentsCount, "комментиариев", "комментарий", "комментария");
         default:
             return ValueToString(commentsCount, "comment", "comments");
     }
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:10,代码来源:NumberTranslator.cs


示例18: RegionsToString

 public static string RegionsToString(int regionsCount, Culture culture)
 {
     switch (culture)
     {
         case Culture.Ru:
             return ValueToString(regionsCount, "регионов", "регион", "региона");
         default:
             return ValueToString(regionsCount, "region", "regions");
     }
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:10,代码来源:NumberTranslator.cs


示例19: GetLocalizableStrings

 public List<LocalizableStringVm> GetLocalizableStrings(Culture culture)
 {
     var package = culture == Culture.EN ? _enuResourcePackage : _ruResourcePackage;
     var strings = from stringItem in package.RootGroup.Items
         select new LocalizableStringVm {
             Name = stringItem.Name,
             Value = stringItem.StringValue
         };
     return strings.ToList();
 }
开发者ID:vadimart92,项目名称:ResourceLocalizer,代码行数:10,代码来源:ResourceLoader.cs


示例20: Initialize_Constructor

        public void Initialize_Constructor(Culture culture, string expectedParameter, string expectedMessage)
        {
            SetCulture(culture);

            ArgumentWhiteSpaceException ex = null;

            Assert.That(() => ex = new ArgumentWhiteSpaceException(), Throws.Nothing);
            Assert.That(ex.ParamName, Is.EqualTo(expectedParameter));
            Assert.That(ex.Message, Is.EqualTo(expectedMessage));
            Assert.That(ex.InnerException, Is.EqualTo(null));
        }
开发者ID:akordowski,项目名称:NToolbox,代码行数:11,代码来源:ArgumentWhiteSpaceExceptionTest.cs



注:本文中的Culture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CultureInfo类代码示例发布时间:2022-05-24
下一篇:
C# CudaDeviceVariable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap