本文整理汇总了C#中Sex类的典型用法代码示例。如果您正苦于以下问题:C# Sex类的具体用法?C# Sex怎么用?C# Sex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sex类属于命名空间,在下文中一共展示了Sex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SavePerson
public void SavePerson(string name, Sex sex, DateTime birthDateUtc, string biography)
{
// Let's also practice exception handling.
if (String.IsNullOrEmpty(name)) throw new ArgumentNullException("name");
var person = _personRepository.Fetch(record => record.Name == name).FirstOrDefault();
if (person == null)
{
person = new PersonRecord();
_personRepository.Create(person);
}
person.Name = name;
person.Sex = sex;
person.BirthDateUtc = birthDateUtc;
person.Biography = biography;
// Running filters
// Normally we don't persist the result of filters though.
foreach (var filter in _filters)
{
person.Biography = filter.FilterBiography(person.Biography);
}
}
示例2: Person
public Person(string name, DateTime birthday, Sex gender)
{
this.Name = name;
this.Birthday = birthday;
this.Gender = gender;
this.Id = NEXT_ID++;
}
示例3: Result
public Result(Age a, Sex s, Profession p, Education e, YesNo cit,
List<Technology> tech, Frequency pub, Frequency home,
NumPass single, List<PassType> passType, Frequency pChange,
YesNo sharePass,YesNo pSecure, YesNo passHome,YesNo pMobile,
YesNo hWifiPass, YesNo hWifiFire, YesNo hVirusSoftware, YesNo softUpdate,
SecureLevel sLevel, SharePersonalInfo postPersonal, Frequency pWifi)
{
m_age = a;
m_sex = s;
m_profession = p;
m_education = e;
m_usCitizen = cit;
m_technologyList = tech;
m_publicComputer = pub;
m_homeComputer = home;
m_singlePass = single;
m_passType = passType;
m_passChangeFreq = pChange;
m_sharePassword = sharePass;
m_passSecure = pSecure;
m_passHomePC = passHome;
m_passForMobile = pMobile;
m_homeWifiPass = hWifiPass;
m_homeWifiFirewall = hWifiFire;
m_homeVirusSoftware = hVirusSoftware;
m_softwareUpdates = softUpdate;
m_securityLevel = sLevel;
m_postPersonalInfo = postPersonal;
m_publicWifi = pWifi;
}
示例4: Person
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="ctxt"></param>
public Person(SerializationInfo info, StreamingContext ctxt)
{
_full_name = info.GetString("full_name");
_sex = (Sex)info.GetValue("sex", typeof(Sex));
_birth_date = info.GetDateTime("birth_date");
_photo_path = info.GetString("photo_path");
}
示例5: Dog
//constructor
public Dog(string name, int age, Sex sex, FurColour furColour)
{
this.Name = name;
this.Age = age;
this.Sex = sex;
this.FurColour = furColour;
}
示例6: Entity
Entity(long date, Sex sex, int motherId, int fatherId)
{
_birthday = date;
_sex = sex;
_motherId = motherId;
_fatherId = fatherId;
}
示例7: CreatePlayer
private static Player CreatePlayer(string name, PlayerColor color, Sex sex, int n)
{
var player = new Player(name, color, sex);
int i = 0;
StuffManager stuffManager = StuffManager.Instance;
foreach (IDxMCard dxMCard in stuffManager.DxMCards)
{
if (dxMCard is ICheatCard) continue;
if (dxMCard is IRaceCard && player.RaceCards.Count < 2)
player.RaceCards.Add((IRaceCard)dxMCard);
else if (dxMCard is IClassCard && player.ClassCards.Count < 2)
player.ClassCards.Add((IClassCard)dxMCard);
else if (dxMCard is IHalfBreededCard)
player.HalfBreededCard = (IHalfBreededCard)dxMCard;
else if (dxMCard is ISuperManchkinCard)
player.SuperManchkinCard = (ISuperManchkinCard)dxMCard;
else
player.HandCards.Add(dxMCard);
}
foreach (ITreasureCard treasureCard in stuffManager.TreasureCards)
{
ICheatCard cheatCard = i++ == 4 ? stuffManager.DxMCards.OfType<ICheatCard>().Single() : null;
player.WornItems.Add(Tuple.Create(treasureCard, cheatCard));
}
/*
for (int j = 0; j < n * 2; j++)
player.HandCards.Add(cardManager.TreasureCards.First());
*/
return player;
}
示例8: OnCreatePlayer
/// <summary>
/// 创建玩家
/// </summary>
/// <param name="netstate"></param>
/// <param name="playerName"></param>
/// <param name="sex"></param>
public void OnCreatePlayer(NetState netstate, string playerName, Sex sex)
{
// 如果已经创建过(例如玩家连续点了两次创建角色)
var player = WorldEntityManager.PlayerCache.GetEntity(netstate.BizId);
if (player != null)
{
ClientProxy.Login.CreatePlayerResult(netstate, CraetePlayerResult.Fail);
return;
}
player = new Player
{
Id = netstate.BizId,
AccountId = netstate.BizId,
Name = playerName,
Sex = sex,
NetState = netstate
};
DB.GameDB.InsertEntity(player);
WorldEntityManager.PlayerCache.AddOrReplace(player);
Logs.Info("角色 {0}({1}) 创建成功", playerName, player.Id);
netstate.Player = player;
PlayerEnterGame(player);
ClientProxy.Login.CreatePlayerResult(netstate, CraetePlayerResult.Success);
}
示例9: GetPersons
// We'll need this later for PersonListPart.
public IEnumerable<PersonRecord> GetPersons(Sex sex, int maxCount)
{
// _personRepository.Fetch(record => record.Sex == sex).Take(maxCount) would produce the same result. However
// since Fetch() returns an IEnumerable, not an IQueryable, Take() would run on objects, not translated to SQL.
// Hence the below version can perform better.
return _personRepository.Table.Where(record => record.Sex == sex).Take(maxCount);
}
示例10: AnnualPolicy
public AnnualPolicy(Age age, Sex gender, Destination destination, Tax tax)
{
this.age = age;
this.gender = gender;
this.destination = destination;
this.tax = tax;
}
示例11: SetRecomendedCalories
public static void SetRecomendedCalories(int age, Sex sex) {
if (sex == Sex.Female) {
if (age == 12) {
DailyRecomendedCalories = 1800;
}
else if (age > 12 && age < 15) {
DailyRecomendedCalories = 2000;
}
else if (age == 15) {
DailyRecomendedCalories = 2200;
}
else if (age > 16 && age < 19) {
DailyRecomendedCalories = 2400;
}
else if (age > 18 && age < 21) {
DailyRecomendedCalories = 2600;
}
else {
DailyRecomendedCalories = 2400;
}
}
if (sex == Sex.Male) {
if (age < 14) {
DailyRecomendedCalories = 1600;
}
else if (age > 13 && age < 19) {
DailyRecomendedCalories = 1800;
}
else {
DailyRecomendedCalories = 2000;
}
}
}
示例12: CreatePair
Human CreatePair(Human human, Sex gender)
{
if (human == null)
{
throw new ArgumentNullException();
}
Human newHuman;
if (human is Botan)
{
newHuman = CreateCoolParentPair(human as Botan);
}
else if (human is CoolParent)
{
newHuman = CreateBotanPair(human as CoolParent, gender);
}
else if (human is Student)
{
newHuman = CreateParentPair(human as Student);
}
else if (human is Parent)
{
newHuman = CreateStudentPair(human as Parent, gender);
}
else
{
throw new ArgumentNullException();
}
Humans.Add(newHuman);
return newHuman;
}
示例13: Animals
public Animals(float age, string name, Sex sex)
{
this.Age = age;
this.Name = name;
this.Sex = sex;
if (this.GetType().Name == "Tomcat")
{
this.Sex = Sex.male;
}
else if (this.GetType().Name == "Kitten")
{
this.Sex = Sex.female;
}
if (this.GetType().Name == "Dog")
{
this.Sound = "Woof-Woof";
}
else if (this.GetType().Name == "Kitten")
{
this.Sound = "Meooow";
}
else if (this.GetType().Name == "Tomcat")
{
this.Sound = "Meow";
}
else if (this.GetType().Name == "Frog")
{
this.Sound = "Ribbit-ribbit";
}
}
示例14: Build
public IEntity Build()
{
if (_sex == Sex.UNDEFINED)
_sex = GetRandomSex();
return new Entity(_birthday, _sex, _motherId, _fatherId);
}
示例15: Animals
public Animals(string name, byte age, Sex sex)
{
this.Name = name;
this.Age = age;
Sex gender = sex;
this.Sound = "";
}
开发者ID:Kaloyan-kasskata-Anastasov,项目名称:All-HomeWorks-SoftwareUniversity-TelerikAcademy,代码行数:7,代码来源:Animals.cs