📄 igenotype.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
namespace GeneticAlgorithmLib
{
public interface IGenotype
{
[Editor(typeof(CollectionEditor), typeof(UITypeEditor))]
List<Gene> Genes { get; }
}
public class Gene
{
public Gene(string Name, EGene Value)
{
this.m_NameString = Name;
this.m_Value = Value;
}
#region NameString
private string m_NameString;
public string NameString
{
get { return m_NameString; }
}
#endregion
#region Value
private EGene m_Value;
public EGene Value
{
get { return m_Value; }
}
#endregion
#region Name
public string Name
{
get { return this.ToString(); }
}
#endregion
public override string ToString()
{
return string.Format("{0} - {1}",
this.NameString, this.Value == EGene.On ? "Sum" : "Prod");
}
public void SetGene(EGene Gene)
{
this.m_Value = Gene;
}
}
[Flags]
public enum EGene
{
Off = 0,
On = 1,
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -