本文整理汇总了C#中Boolean类的典型用法代码示例。如果您正苦于以下问题:C# Boolean类的具体用法?C# Boolean怎么用?C# Boolean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Boolean类属于命名空间,在下文中一共展示了Boolean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"]);
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
示例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;
}
示例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";
}
}
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例12: 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();
}
示例13: 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;
}
}
示例14: 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;
}
示例15: ZipArchiveEntry
//Initializes, attaches it to archive
internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd)
{
_archive = archive;
_originallyInArchive = true;
_diskNumberStart = cd.DiskNumberStart;
_versionToExtract = (ZipVersionNeededValues)cd.VersionNeededToExtract;
_generalPurposeBitFlag = (BitFlagValues)cd.GeneralPurposeBitFlag;
CompressionMethod = (CompressionMethodValues)cd.CompressionMethod;
_lastModified = new DateTimeOffset(ZipHelper.DosTimeToDateTime(cd.LastModified));
_compressedSize = cd.CompressedSize;
_uncompressedSize = cd.UncompressedSize;
_offsetOfLocalHeader = cd.RelativeOffsetOfLocalHeader;
/* we don't know this yet: should be _offsetOfLocalHeader + 30 + _storedEntryNameBytes.Length + extrafieldlength
* but entryname/extra length could be different in LH
*/
_storedOffsetOfCompressedData = null;
_crc32 = cd.Crc32;
_compressedBytes = null;
_storedUncompressedData = null;
_currentlyOpenForWrite = false;
_everOpenedForWrite = false;
_outstandingWriteStream = null;
FullName = DecodeEntryName(cd.Filename);
_lhUnknownExtraFields = null;
//the cd should have these as null if we aren't in Update mode
_cdUnknownExtraFields = cd.ExtraFields;
_fileComment = cd.FileComment;
_compressionLevel = null;
}