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

C# Case类代码示例

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

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



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

示例1: Merge

        public static void Merge(Case[] cases, int left, int mid, int right)
        {
            Case [] temp = new Case[20];
            int i, left_end, num_elements, tmp_pos;

            left_end = (mid - 1);
            tmp_pos = left;
            num_elements = (right - left + 1);

            while ((left <= left_end) && (mid <= right))
            {
                if (ComparePriority(cases[left].priority, cases[mid].priority))
                    temp[tmp_pos++] = cases[left++];
                else
                    temp[tmp_pos++] = cases[mid++];
            }

            while (left <= left_end)
                temp[tmp_pos++] = cases[left++];

            while (mid <= right)
                temp[tmp_pos++] = cases[mid++];

            for (i = 0; i < num_elements; i++)
            {
                cases[right] = temp[right];
                right--;
            }
        }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:29,代码来源:UnitTest1.cs


示例2: ToCase

        /// <summary>
        /// Converts the phrase to specified convention.
        /// </summary>
        /// <param name="phrase"></param>
        /// <param name="cases">The cases.</param>
        /// <returns>string</returns>
        public static string ToCase(this string phrase, Case cases)
        {
            string[] splittedPhrase = phrase.Split(' ', '-', '.');
            var sb = new StringBuilder();

            if (cases == Case.CamelCase)
            {

                sb.Append(char.ToLower(splittedPhrase[0][0]));
                sb.Append(splittedPhrase[0].Substring(1));
                splittedPhrase[0] = string.Empty;
            }
            else if (cases == Case.PascalCase)
                sb = new StringBuilder();

            foreach (var s in splittedPhrase)
            {
                char[] splittedPhraseChars = s.ToCharArray();
                if (splittedPhraseChars.Length > 0)
                {
                    splittedPhraseChars[0] = ((new String(splittedPhraseChars[0], 1)).ToUpper().ToCharArray())[0];
                }
                sb.Append(new String(splittedPhraseChars));
            }
            return sb.ToString();
        }
开发者ID:pellehenriksson,项目名称:ReSTore,代码行数:32,代码来源:CaseExtensions.cs


示例3: GeneratePropertyCode

        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            if (documentType != DocumentType.Xml)
            {
                return base.GeneratePropertyCode(propertyName, classCase, attributes, documentType);
            }

            var sb = new StringBuilder();

            sb.AppendFormat(
                @"[XmlIgnore]
            public {0} {1} {{ get; set; }}", TypeAlias, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0} == null ? null : {0}{1};
            }}
            set
            {{
            {0} = string.IsNullOrEmpty(value) ? null : ({2}){3};
            }}
            }}", propertyName, _toString, TypeAlias, _parse);

            return sb.ToString();
        }
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:33,代码来源:NullableBclClass.cs


示例4: Write

        public void Write(string @namespace, Case classCase, Case propertyCase, TextWriter writer, bool skipNamespace, DocumentType documentType)
        {
            WriteHeader(writer, documentType);

            if (!skipNamespace)
            {
                WriteUsings(writer, documentType);
                writer.WriteLine();
                writer.WriteLine("namespace {0}", @namespace);
                writer.WriteLine("{");
            }

            var usedClasses = _repository.GetUsedClasses().ToList();

            if (usedClasses.Count == 0)
            {
                writer.WriteLine("/* No used classes found! */");
            }

            writer.WriteLine(
                string.Join(
                    "\r\n\r\n",
                    _repository.GetUsedClasses().Select(x => x.GenerateCSharpCode(classCase, propertyCase, documentType))));

            if (!skipNamespace)
            {
                writer.WriteLine("}");
            }
        }
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:29,代码来源:ClassGenerator.cs


示例5: Create_Case

        public Create_Case(Case incomingCase, string _formEditMode)
        {
            InitializeComponent();
            formEditMode = _formEditMode;

            NewCase = incomingCase;
        }
开发者ID:the-simian,项目名称:TREND-Application,代码行数:7,代码来源:Create_Case.cs


示例6: Execute

 public void Execute(Case @case, Action next)
 {
     //Behavior chooses not to invoke next().
     //Since the cases are never invoked, they don't
     //have the chance to throw exceptions, resulting
     //in all 'passing'.
 }
开发者ID:leijiancd,项目名称:fixie,代码行数:7,代码来源:CaseLifecycleTests.cs


示例7: PersonalPronoun

 private PersonalPronoun(Case personalPronounCase, Number number, Person person, string name)
 {
     _case = personalPronounCase;
       _number = number;
       _person = person;
       _name = name;
 }
开发者ID:skeletank,项目名称:Language-Learning,代码行数:7,代码来源:PersonalPronoun.cs


示例8: GeneratePropertyCode

        public string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            string typeName;

            var userDefinedClass = _class as UserDefinedClass;
            if (userDefinedClass != null)
            {
                typeName =
                    string.IsNullOrEmpty(userDefinedClass.CustomName)
                        ? userDefinedClass.TypeName.FormatAs(classCase)
                        : userDefinedClass.CustomName;
            }
            else
            {
                typeName = ((IBclClass)_class).TypeAlias;
            }

            var sb = new StringBuilder();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(string.Format("{0}", attribute.ToCode()));
            }

            sb.AppendFormat("public List<{0}> {1} {{ get; set; }}", typeName, propertyName);

            return sb.ToString();
        }
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:28,代码来源:ListClass.cs


示例9: APISpecExample

    public APISpecExample()
    {
      Contract.Ensures(State == Case.A);

      _case = Case.A;

    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:Protocols.cs


示例10: GeneratePropertyCode

        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            var sb = new StringBuilder();

            var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]";

            sb.AppendFormat(
                @"{0}
            public DateTime {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0}.ToString(""{1}"", new CultureInfo(""en-US""));
            }}
            set
            {{
            {0} = DateTime.ParseExact(value, ""{1}"", new CultureInfo(""en-US""));
            }}
            }}", propertyName, Format);

            return sb.ToString();
        }
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:30,代码来源:FormattedDateTime.cs


示例11: GeneratePropertyCode

        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            var sb = new StringBuilder();

            var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]";

            sb.AppendFormat(
                @"{0}
            public bool {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0} ? ""True"" : ""False"";
            }}
            set
            {{
            {0} = bool.Parse(value);
            }}
            }}", propertyName);

            return sb.ToString();
        }
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:30,代码来源:PascalCaseBooleanClass.cs


示例12: CaseDetailWindow

 public CaseDetailWindow (Case c, Gtk.Window parent) :
         base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     case_show.Case = c;
     case_show.HideEditingButtons ();
 }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:7,代码来源:CaseDetailWindow.cs


示例13: Execute

        public void Execute(Type testClass, Convention convention, Case[] cases)
        {
            foreach (var @case in cases)
            {
                var exceptions = @case.Exceptions;

                try
                {
                    var instance = construct(testClass);

                    var fixture = new Fixture(testClass, instance, convention.CaseExecution.Behavior, new[] { @case });
                    convention.InstanceExecution.Behavior.Execute(fixture);

                    Lifecycle.Dispose(instance);
                }
                catch (PreservedException preservedException)
                {
                    var constructionException = preservedException.OriginalException;
                    exceptions.Add(constructionException);
                }
                catch (Exception constructionException)
                {
                    exceptions.Add(constructionException);
                }
            }
        }
开发者ID:ncgonz,项目名称:fixie,代码行数:26,代码来源:CreateInstancePerCase.cs


示例14: ShouldBe

 public static void ShouldBe(this string actual, string expected, Case caseSensitivity, [InstantHandle] Func<string> customMessage)
 {
     if (caseSensitivity == Case.Sensitive)
         ShouldBe(actual, expected, customMessage);
     else
         ShouldBe(actual, expected, customMessage, StringCompareShould.IgnoreCase);
 }
开发者ID:sholland1,项目名称:shouldly,代码行数:7,代码来源:StringShouldBeTestExtensions.cs


示例15: onCaseClick

    public void onCaseClick(Case c)
    {
        if (c.getUnit () == null)
        {
            Debug.Log (c.posX + " - " + c.posY);
            if (selectedUnit)
            {
                selectedUnit.setSelected (false);
                setSelectedUnit (null);
            }
        }
        else
        {
            if (selectedUnit && selectedUnit != c.getUnit ())
            {
                selectedUnit.setSelected (false);
                c.getUnit ().setSelected (true);
            }
            else if (selectedUnit != c.getUnit ())
            {
                c.getUnit ().setSelected (true);
            }

            setSelectedUnit(c.getUnit ());

            Debug.Log (c.posX + " - " + c.posY + " " + c.getUnit().gameObject.name);
        }
    }
开发者ID:Robien,项目名称:OW,代码行数:28,代码来源:UIManager.cs


示例16: Check_Equal_StrContent

        public void Check_Equal_StrContent(Case.BasicTestCase refTestCase, string sourceDataName, string dataObjectName, bool isInterupt, Core.CodeProcessor.CodeLine activeSelectLine)
        {
            if(refTestCase!=null)
            {
                if (refTestCase.ActiveDataBuffer.ContainsKey(sourceDataName) && refTestCase.ActiveDataBuffer.ContainsKey(dataObjectName))
                {
                    string sourceDataValue = refTestCase.ActiveDataBuffer[sourceDataName];
                    string objectDataValue = refTestCase.ActiveDataBuffer[dataObjectName];

                    if (sourceDataValue != objectDataValue)
                    {
                        if (isInterupt)
                        {
                            refTestCase.SingleInterrupt = true;
<<<<<<< HEAD
=======
                            refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse StrContent Not Equal : " + sourceDataValue + " != " + objectDataValue, true);
                        }
                        else
                            refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse StrContent Not Equal : " + sourceDataValue + " != " + objectDataValue, true);
                    }
                }
                else
                {
                    refTestCase.SingleInterrupt = true;
                    refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse Exception : Can not find symbol - " + sourceDataName + " or " + dataObjectName, true);
                }
            }
        }
开发者ID:newsike,项目名称:Buffalo-Famework,代码行数:29,代码来源:AnalyseContent.cs


示例17: CaseReportWindow

 public CaseReportWindow (Case acase) :
         base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     this.Modal = true;
     _case = acase;
 }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:7,代码来源:CaseReportWindow.cs


示例18: PassResult

 public PassResult(Case @case)
 {
     Name = @case.Name;
     MethodGroup = @case.MethodGroup;
     Output = @case.Output;
     Duration = @case.Duration;
 }
开发者ID:leijiancd,项目名称:fixie,代码行数:7,代码来源:PassResult.cs


示例19: ShouldBe

 /// <summary>
 /// Perform a string comparison, specifying the desired case sensitivity
 /// </summary>
 public static void ShouldBe(this string actual, string expected, Case caseSensitivity)
 {
     var constraint = (caseSensitivity == Case.Sensitive)
                          ? Is.EqualTo(expected)
                          : Is.EqualTo(expected).IgnoreCase;
     actual.AssertAwesomely(constraint, actual, expected);
 }
开发者ID:dahvyd,项目名称:shouldly,代码行数:10,代码来源:ShouldBeStringTestExtensions.cs


示例20: instancierUnHexagone

    public void instancierUnHexagone(int position, Case caseInitiale )
    {
        int decalX, decalY;

        switch (position) {
        case(0) : decalX = 1;
            decalY = 0;
            break;
        case(1) : decalX = 1;
            decalY = 1;
            break;
        case(2) : decalX = (-1);
            decalY = 1;
            break;
        case(3) : decalX = (-1);
            decalY = 0;
            break;
        case(4) : decalX = (-1);
            decalY = (-1);
            break;
        case(5) : decalX = 1;
            decalY = (-1);
            break;

        default:
            decalX = 0;
            decalY = 0;
            break;
        }

        instancierUnHexagone (caseInitiale.coordX + decalX, caseInitiale.coordY + decalY);
    }
开发者ID:JulienNigon,项目名称:ProjetComete,代码行数:32,代码来源:SC_GestionPlanete.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CaseLabel类代码示例发布时间:2022-05-24
下一篇:
C# CartItem类代码示例发布时间: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