#PARAN SILVERLIGHT#
  • Tistory
    • 관리자
    • 글쓰기
Carousel 01
Carousel 02
Previous Next

Replace Nested Conditional with Guard Clauses

PROGRAMING/C# 2012. 12. 10. 10:34

 

namespace ReplaceNestedConditionalWithGuardClauses
{
    class Program
    {
        static void Main(string[] args)
        {
           
            Console.WriteLine(PersonIsfligible(16, true, true, true));
            Console.WriteLine(PersonIsfligible(18, true, true, true));
            Console.WriteLine(PersonIsfligible(16, true, true, false));
            Console.WriteLine(PersonIsfligible(16, true, false, true));
        }

        //Some sort of contest entry requirements!
        public static bool PersonIsfligible(int age, bool canadianCitizen, bool acceptedConditionOfEntry, bool IsfulltimeStudent)
        {
            //Gurad Cludeses : 아래 condion의 문장의 부정으로 조건 문을 만들고 return false
            if (age < 18) return false;
            if (!canadianCitizen) return false;
            if (!acceptedConditionOfEntry) return false;
            if (!IsfulltimeStudent) return false;

            return true;
            
            ////nested conditions
            //if (age > 18)
            //{
            //    if (canadianCitizen)
            //    {
            //        if (IsfulltimeStudent)
            //        {
            //            //if statement  can go on
            //            return true;
                       
            //        }
                   
            //    }
               
            //}

            //return false;
        }
    }


}

저작자표시 비영리 (새창열림)
블로그 이미지

파란실버라이트

To remember the time when I started learning Silver Light!

,

카테고리

  • Inforamtion Technology (281)
    • DESIGN PATTERN (33)
      • 실용주의 디자인패턴 (29)
    • SOFTWARE ENGINEERING (21)
      • Art Of Readable Code (12)
      • Object Oriented Programming (6)
      • TDD (2)
    • FRAMEWORK (22)
      • Spring.net (2)
      • LightSwitch (20)
    • PROGRAMING (58)
      • C# (20)
      • .NET (6)
      • HTML5 (7)
      • ASP.NET (9)
      • SILVERLIGHT (7)
      • Ruby On Rails (6)
    • PROJECT MANAGEMENT (10)
      • SW Version Management (7)
      • Schedulring Management (1)
    • BOOKS (18)
    • MOBILE APP (1)
      • SENCHA TOUCH (1)
    • SECURITY (5)
    • MES (1)
    • B2B (14)
      • WEBMETHODS (4)
    • ERP (53)
      • SAP/R/3 (51)
    • ABOUT TOOLS (2)
    • FUNDAMENT CONCEPT (21)
    • SOA BPM (22)
    • PORTFOLIO (0)

태그목록

  • 프로그래밍
  • 동시성
  • 병렬

최근에 받은 트랙백

글 보관함

링크

파란실버라이트

블로그 이미지

To remember the time when I started learning Silver Light!

LATEST FROM OUR BLOG

RSS 구독하기

LATEST COMMENTS

BLOG VISITORS

  • Total :
  • Today :
  • Yesterday :

Copyright © 2015 Socialdev. All Rights Reserved.

티스토리툴바