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

C# Boolean类代码示例

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

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



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

示例1: Basico

 public Basico(DataRow row)
 {
     this._id = Convert.ToInt32(row["id"]);
     this._cadastro = Convert.ToDateTime(row["cadastro"]);
     this._atualizacao = Convert.ToDateTime(row["atualizacao"]);
     this._ativo = Convert.ToBoolean(row["ativo"]);
 }
开发者ID:neutonmelo,项目名称:Meus-Pedidos,代码行数:7,代码来源:Basico.cs


示例2: KawigiEdit_RunTest

 private static Boolean KawigiEdit_RunTest(int testNum, string p0, Boolean hasAnswer, int p1)
 {
     Console.Write("Test " + testNum + ": [" + "\"" + p0 + "\"");
     Console.WriteLine("]");
     RaiseThisBarn obj;
     int answer;
     obj = new RaiseThisBarn();
     DateTime startTime = DateTime.Now;
     answer = obj.calc(p0);
     DateTime endTime = DateTime.Now;
     Boolean res;
     res = true;
     Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
     if (hasAnswer) {
         Console.WriteLine("Desired answer:");
         Console.WriteLine("\t" + p1);
     }
     Console.WriteLine("Your answer:");
     Console.WriteLine("\t" + answer);
     if (hasAnswer) {
         res = answer == p1;
     }
     if (!res) {
         Console.WriteLine("DOESN'T MATCH!!!!");
     } else if ((endTime - startTime).TotalSeconds >= 2) {
         Console.WriteLine("FAIL the timeout");
         res = false;
     } else if (hasAnswer) {
         Console.WriteLine("Match :-)");
     } else {
         Console.WriteLine("OK, but is it right?");
     }
     Console.WriteLine("");
     return res;
 }
开发者ID:root85,项目名称:olymp-programming,代码行数:35,代码来源:RaiseThisBarn.cs


示例3: GetItemproportion

    //获取投票数量的比例
    public string GetItemproportion(string pis_xxid, Boolean bl)
    {
        string rValue;
        HyoaClass.DAO db = new HyoaClass.DAO();

        //总参与投票数
        double ls_tpall;
        string ls_sql1 = " Select * from hyk_whzx_tpgl_tpmx where hy_tpztid ='" + this.txtdocid.Value + "' ";
        DataTable dt1 = db.GetDataTable(ls_sql1);
        ls_tpall = dt1.Rows.Count;

        //得到某一个选项投票数
        double ls_tpxx;
        string ls_sql2 = " Select * from hyk_whzx_tpgl_tpmx where hy_tpztid ='" + this.txtdocid.Value + "' and hy_tpxxid ='" + pis_xxid + "' ";
        DataTable dt2 = db.GetDataTable(ls_sql2);
        ls_tpxx = dt2.Rows.Count;

        double ls_num = 0.0;
        if (ls_tpxx != 0)
        {
            ls_num = (ls_tpxx / ls_tpall) * 100;
        }
        if (bl)
        {
            rValue = ls_num.ToString("#0.#0") + "%";
        }
        else
        {
            rValue = ls_num.ToString("#0.#0");
        }
        dt1.Clear();
        dt2.Clear();
        db.Close();
        return rValue;
    }
开发者ID:wjszxli,项目名称:Webapp,代码行数:36,代码来源:main_tpgl_wytp.aspx.cs


示例4: Document

 public Document(
     Int16 _TypeId,
     Int64 _Serial,
     Int32 _SignedUser,
     DateTime _Date,
     Boolean _Printed,
     String _DocumentShortName,
     String _DocumentFullName,
     String _MedexDataTable,
     String _DocumentBody,
     String _DocumentHeader,
     Boolean _SetDeleted
     
     )
 {
     TypeId = _TypeId;
        Serial = _Serial;
        SignedUser = _SignedUser;
        Date = _Date;
        Printed = _Printed;
        DocumentShortName = _DocumentShortName;
        DocumentFullName = _DocumentFullName;
        MedexDataTable = _MedexDataTable;
        DocumentBody = _DocumentBody;
        DocumentHeader = _DocumentHeader;
        SetDeleted = _SetDeleted;
 }
开发者ID:oeai,项目名称:medx,代码行数:27,代码来源:Document.cs


示例5: Service

            public Service()
            {
                //log4net.Util.LogLog.InternalDebugging = true;

                ODws = new CustomService(this.Context);//INFO we can extend this for other service types

                try
                {
                    useODForValues = Boolean.Parse(ConfigurationManager.AppSettings["UseODForValues"]);
                }
                catch (Exception e)
                {
                    String error = "Missing or invalid value for UseODForValues. Must be true or false";
                    log.Fatal(error);

                    throw new SoapException("Invalid Server Configuration. " + error,
                                         new XmlQualifiedName(SoapExceptionGenerator.ServerError));
                }

                try
                {
                    requireAuthToken = Boolean.Parse(ConfigurationManager.AppSettings["requireAuthToken"]);
                }
                catch (Exception e)
                {
                    String error = "Missing or invalid value for requireAuthToken. Must be true or false";
                    log.Fatal(error);
                    throw new SoapException(error,
                                            new XmlQualifiedName(SoapExceptionGenerator.ServerError));

                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:32,代码来源:Service_1_1.cs


示例6: KawigiEdit_RunTest

 private static Boolean KawigiEdit_RunTest(int testNum, int p0, int p1, int p2, Boolean hasAnswer, double p3)
 {
     Console.Write("Test " + testNum + ": [" + p0 + "," + p1 + "," + p2);
     Console.WriteLine("]");
     TwoLotteryGames obj;
     double answer;
     obj = new TwoLotteryGames();
     DateTime startTime = DateTime.Now;
     answer = obj.getHigherChanceGame(p0, p1, p2);
     DateTime endTime = DateTime.Now;
     Boolean res;
     res = true;
     Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
     if (hasAnswer) {
         Console.WriteLine("Desired answer:");
         Console.WriteLine("\t" + p3);
     }
     Console.WriteLine("Your answer:");
     Console.WriteLine("\t" + answer);
     if (hasAnswer) {
         res = Math.Abs(p3 - answer) <= 1e-9 * Math.Max(1.0, Math.Abs(p3));
     }
     if (!res) {
         Console.WriteLine("DOESN'T MATCH!!!!");
     } else if ((endTime - startTime).TotalSeconds >= 2) {
         Console.WriteLine("FAIL the timeout");
         res = false;
     } else if (hasAnswer) {
         Console.WriteLine("Match :-)");
     } else {
         Console.WriteLine("OK, but is it right?");
     }
     Console.WriteLine("");
     return res;
 }
开发者ID:karunasagark,项目名称:ps,代码行数:35,代码来源:TwoLotteryGames.cs


示例7: chk_image

 public static string chk_image(string file, string path, string url, Boolean cache)
 {
     if (cache)
     {
         if (File.Exists(path + file))
         {
             return path + file;
         }
         else if (is_online)
         {
             WebClient dl = new WebClient();
             dl.DownloadFile(url, path + file);
             return path + file;
         }
         else
         {
             return "offline_icon.png";
         }
     }
     else
     {
         if (File.Exists(path + file))
         {
             return path + file;
         }
         else if (is_online)
         {
             return url;
         }
         else
         {
             return "offline_icon.png";
         }
     }
 }
开发者ID:ToyzStore,项目名称:-ACID-Cache-Cleaner,代码行数:35,代码来源:File_elper.cs


示例8: addUser

    public USUARIO addUser(String nombre, String clave, int institucionid, int perfil, Boolean validate)
    {
        USUARIO user = new USUARIO();
        List<USUARIO> users = new List<USUARIO>();
        if (validate)
        {
            users = obtainUserByUserName(nombre);
        }

        if (users.Count <= 0)
        {
            try
            {
                user.USUARIOID = 0;
                user.NOMBRE = nombre;
                user.CLAVE = InstitucionesUtil.Encripta(clave);
                user.INSTITUCIONID = institucionid;
                user.PERFIL = perfil;

                Datos.USUARIOs.Add(user);
                Datos.SaveChanges();
            }
            catch (Exception ex)
            {
                string x = ex.Message;
            }
        }
        return user;
    }
开发者ID:fabianpsilvam,项目名称:instituciones,代码行数:29,代码来源:USUARIO.cs


示例9: Read

 public void Read(BinaryReader r)
 {
     //if (r == null) throw new ArgumentNullException("r");
     FResult     = new StringBuilder(r.ReadString());
     FSeparator  = r.ReadString();
     FEmpty      = r.ReadBoolean();
 }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:7,代码来源:Strings.cs


示例10: PropagateSettingToApplyMethodCollection

            public void PropagateSettingToApplyMethodCollection(Boolean applyOptional)
            {
                var attribute = new ApplyByRegistrationAttribute(typeof(FakeMapping)) { ApplyOptional = applyOptional };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(applyOptional, applyMethods.ApplyOptional);
            }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:7,代码来源:ApplyByRegistrationAttributeTests.cs


示例11: TestToBoolean

 public Boolean TestToBoolean(Boolean testSubject){
 strLoc = "Loc_498yv";
 Boolean b1 = false;
 Boolean b2 = false;
 Boolean pass = false;
 Boolean excthrown = false;
 Object exc1 = null;
 Object exc2 = null;
 try {
 b1 = ((IConvertible)testSubject).ToBoolean(null);
 pass = true;
 excthrown = false;
 } catch (Exception exc) {
 exc1 = exc;
 pass = false;
 excthrown = true;
 }
 try {
 b2 = Convert.ToBoolean(testSubject);
 pass = pass & true;
 } catch (Exception exc) {
 exc2 = exc;
 pass = false;
 excthrown = excthrown & true;
 }
 if(excthrown)
   if(exc1.GetType() == exc2.GetType())
     return true;
   else
     return false;
 else if(pass && b1 == b2)
   return true;
 else
   return false;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:35,代码来源:co5712iconvertible_boolean.cs


示例12: checkCtaAvailability

 public void checkCtaAvailability(int type, int minimumAward, Boolean isDirect, Action<Boolean, Boolean> action)
 {
     developerCtaInterface.Call("checkCtaAvailability", type, minimumAward, isDirect);
     if (actionPool.ContainsKey (minimumAward * MAX_TYPE_COUNT + type))
         actionPool.Remove (minimumAward * MAX_TYPE_COUNT + type);
     actionPool.Add (minimumAward * MAX_TYPE_COUNT + type, action);
 }
开发者ID:JavadAbedi,项目名称:TapsellUnity4Example,代码行数:7,代码来源:DeveloperCtaInterface.cs


示例13: GetServicesList

        public string GetServicesList(string providerName, Boolean ViewAsXml)
        {

            SimpleFacade wSimpleFacade = CreateSimpleFacade();
            return wSimpleFacade.GetServicesList(providerName, ViewAsXml);

        }
开发者ID:gpanayir,项目名称:sffwk,代码行数:7,代码来源:SingleService.asmx.cs


示例14: KawigiEdit_RunTest

 private static Boolean KawigiEdit_RunTest(int testNum, int p0, int p1, int p2, Boolean hasAnswer, int p3)
 {
     Console.Write("Test " + testNum + ": [" + p0 + "," + p1 + "," + p2);
     Console.WriteLine("]");
     ExcitingGame obj;
     int answer;
     obj = new ExcitingGame();
     DateTime startTime = DateTime.Now;
     answer = obj.howMany(p0, p1, p2);
     DateTime endTime = DateTime.Now;
     Boolean res;
     res = true;
     Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
     if (hasAnswer) {
         Console.WriteLine("Desired answer:");
         Console.WriteLine("\t" + p3);
     }
     Console.WriteLine("Your answer:");
     Console.WriteLine("\t" + answer);
     if (hasAnswer) {
         res = answer == p3;
     }
     if (!res) {
         Console.WriteLine("DOESN'T MATCH!!!!");
     } else if ((endTime - startTime).TotalSeconds >= 2) {
         Console.WriteLine("FAIL the timeout");
         res = false;
     } else if (hasAnswer) {
         Console.WriteLine("Match :-)");
     } else {
         Console.WriteLine("OK, but is it right?");
     }
     Console.WriteLine("");
     return res;
 }
开发者ID:karunasagark,项目名称:ps,代码行数:35,代码来源:ExcitingGame.cs


示例15: KawigiEdit_RunTest

 private static Boolean KawigiEdit_RunTest(int testNum, int p0, int p1, Boolean hasAnswer, long p2)
 {
     Console.Write("Test " + testNum + ": [" + p0 + "," + p1);
     Console.WriteLine("]");
     Apportionment obj;
     long answer;
     obj = new Apportionment();
     DateTime startTime = DateTime.Now;
     answer = obj.numberOfSquares(p0, p1);
     DateTime endTime = DateTime.Now;
     Boolean res;
     res = true;
     Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
     if (hasAnswer) {
         Console.WriteLine("Desired answer:");
         Console.WriteLine("\t" + p2);
     }
     Console.WriteLine("Your answer:");
     Console.WriteLine("\t" + answer);
     if (hasAnswer) {
         res = answer == p2;
     }
     if (!res) {
         Console.WriteLine("DOESN'T MATCH!!!!");
     } else if ((endTime - startTime).TotalSeconds >= 2) {
         Console.WriteLine("FAIL the timeout");
         res = false;
     } else if (hasAnswer) {
         Console.WriteLine("Match :-)");
     } else {
         Console.WriteLine("OK, but is it right?");
     }
     Console.WriteLine("");
     return res;
 }
开发者ID:karunasagark,项目名称:ps,代码行数:35,代码来源:Apportionment.cs


示例16: GetForums

 public ForumCollection<Forum> GetForums(Boolean active)
 {
     ForumCollection<Forum> _coll = new ForumCollection<Forum>(this.ConnectionString);
     ArgumentsList _arg = new ArgumentsList(new ArgumentsListItem("Active", active.ToString()));
     _coll.LitePopulate(_arg, false, null);
     return _coll;
 }
开发者ID:noximus,项目名称:TopOfTheRock,代码行数:7,代码来源:Forum.cs


示例17: runTest

 private Boolean runTest( Boolean verbose )
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     ++iCountTestcases;   		
     if ( verbose ) Console.WriteLine( "Make sure GetRemainingCount is correctly incremented decremented for different arglists" );	
     try {
     NormClass.argit1( __arglist( ) );			
     NormClass.argit1( __arglist( "a", "b", "c", "a", "b", "c", "a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c"  ) );			
     NormClass.argit1( __arglist( ) );
     NormClass.argit1( __arglist(typeof(System.String), null, (int) 1975, (long) 6, (float) 4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char) 'a', (byte) 0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now));
     NormClass.argit1( __arglist( ) );
     }
     catch (Exception ex) {	
     ++iCountErrors;
     Console.WriteLine( "Err_001a,  Unexpected exception was thrown ex: " + ex.ToString() );	
     }
     }
   catch (Exception exc_runTest)
     {
     ++iCountErrors;			
     Console.Error.WriteLine (strName+" "+strTest+" "+strPath);
     Console.Error.WriteLine ("Unexpected Exception (runTest99): "+exc_runTest.ToString());
     }
   Console.WriteLine ();
   Console.WriteLine ("FINAL TEST RESULT:" + strName+" "+strTest+" "+strPath);
   Console.WriteLine ();
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:co6664getremainingcount.cs


示例18: Start

	double updateRate = 4.0;  // 4 updates per sec.

	
	// Use this for initialization
	void Start () {


		toggleDisplay = false;

		transformList =  new string[] {"Hips",  
			"LeftUpLeg", "LeftLeg", "LeftFoot", "LeftToeBase", 
			"RightUpLeg", "RightLeg", "RightFoot", "RightToeBase", 
			"Spine", "Spine1", "Spine2", "Spine3",
			"Neck", "Neck1", "Head",     
			"LeftShoulder", "LeftArm", "LeftForeArm", "LeftHand", 
			"RightShoulder", "RightArm", "RightForeArm", "RightHand", "root"
		};

		foreach (string s in transformList) 
		{
			GameObject o = GameObject.Find (s);

			if (o == null)
			{
				Debug.Log ("Could not find object: " + s);
			}
			else
			{
				objects.Add (s, o);
				rotationOffsets.Add ( s, Quaternion.identity );
				initialOrientation.Add ( s, o.transform.localRotation );
			}
		}

		data = new Byte[8192];

		Connect();

	}
开发者ID:deeni,项目名称:vive,代码行数:39,代码来源:MocapSocket.cs


示例19: setAttackSettings

 public override void setAttackSettings(string attack, float xPos, float yPos)
 {
     //Should set damage and projectileSpeed variables based on the key
     //This method is called when calling spawnProjectile.
     if (xPos < 0)
     {
         startedRight = true;
     }
     else
     {
         startedRight = false;
     }
     //setup attributes of each attack
     if (attack == "blackOrbAttack")
     {
         damage = 1;
         projectileSpeed = blackOrbSpeed;
         angularVelocity = 0;
     } else if (attack == "unblockableAttack")
     {
         damage = 3;
         projectileSpeed = unblockableOrbSpeed;
         angularVelocity = 0;
     }
 }
开发者ID:unit02,项目名称:SoftEng-306-Project-2,代码行数:25,代码来源:BossProjectileSpawner.cs


示例20: Update

    // Update is called once per frame
    void Update()
    {
        int seconds = DateTime.Now.Second % (int)DAYNIGHT_CYCLE_FREQ;

        if (seconds == 0)
        {
            if (_dayNightSeconds != seconds)
            {
                if (_day)
                {
                    _currentTopColor -= _dayNightDiffTop;
                    _currentBottomColor -= _dayNightDiffBottom;
                }
                else
                {
                    _currentTopColor += _dayNightDiffTop;
                    _currentBottomColor += _dayNightDiffBottom;
                }

                UpdateGradient(_currentTopColor, _currentBottomColor);

                _dayNightSeconds = seconds;

                if (_currentTopColor.b < _nightTopColor.b)
                    _day = false;
                if (_currentTopColor.b > _dayTopColor.b)
                    _day = true;
            }
        }
        else
            _dayNightSeconds = -1;
    }
开发者ID:rpheuts,项目名称:hackyball,代码行数:33,代码来源:BackgroundBehavior.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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