本文整理汇总了C#中Prefix类的典型用法代码示例。如果您正苦于以下问题:C# Prefix类的具体用法?C# Prefix怎么用?C# Prefix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Prefix类属于命名空间,在下文中一共展示了Prefix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public string Get(Prefix prefix)
{
var suffixes = chain[prefix];
var index = rnd.Next(suffixes.Count);
return suffixes[index];
}
示例2: FileSize
public FileSize(decimal plainValue, Prefix prefix)
{
PlainValue = plainValue;
Prefix = prefix;
InternalRepresentation = ToInternalRepresentation(plainValue, prefix);
}
示例3: DerivedUnit
/// <summary>
/// Initializes a new instance of the <see cref="DerivedUnit" /> class.
/// </summary>
/// <param name="prefix">The prefix.</param>
/// <param name="notation">The notation.</param>
/// <param name="expression">The expression.</param>
public DerivedUnit(Prefix prefix, string notation, Expression expression)
{
this.prefix = prefix ?? Prefix.None;
this.notation = notation;
this.expression = expression;
this.derivedBaseUnit = new DerivedBaseUnit(expression);
}
示例4: CheatPrefixContainer
/// <summary>
/// Creates a new instance of the CheatPrefixButton class
/// </summary>
/// <param name="i">The Prefix of the CheatPrefixButton</param>
public CheatPrefixContainer(Prefix i)
: base("")
{
Size = new Vector2(80f, 30f);
Prefix = i;
}
示例5: Main
private static void Main()
{
const int MAXGEN = 1000;
var corpus = Resources.english;
var suffixChain = new WordChain();
var prefix = new Prefix();
var words = corpus
.Split(new[] {Environment.NewLine, " "}, StringSplitOptions.RemoveEmptyEntries)
.ToList();
foreach (var word in words)
{
suffixChain.Add(prefix, word);
prefix.Add(word);
}
suffixChain.Add(prefix, NONWORD);
var wordChain = Generate(suffixChain, MAXGEN);
var text = string.Join(" ", wordChain);
Console.WriteLine(text);
}
示例6: Add
public void Add(Prefix prefix, string word)
{
prefix = prefix.Copy();
if (!chain.ContainsKey(prefix))
chain.Add(prefix, new List<string>());
chain[prefix].Add(word);
}
示例7: TestPrefixDefaultConstructor
public void TestPrefixDefaultConstructor()
{
Prefix prefix = new Prefix();
Assert.AreEqual(string.Empty, prefix.Nick);
Assert.AreEqual(string.Empty, prefix.UserName);
Assert.AreEqual(string.Empty, prefix.HostName);
Assert.IsFalse(prefix.Exists);
}
示例8: Create
public ActionResult Create(Prefix prefix)
{
if (ModelState.IsValid)
{
db.Prefixes.Add(prefix);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(prefix);
}
示例9: Ping
public Ping(string server, Prefix prefix, string message)
{
if (String.IsNullOrWhiteSpace(server)) throw new ArgumentException("Null or whitespace string", "server");
if (prefix == null) throw new ArgumentNullException("prefix");
if (String.IsNullOrWhiteSpace(message)) throw new ArgumentException("Null or whitespace string", "message");
this.server = server;
this.prefix = prefix;
this.message = message;
this.ircMessage = Common.CreateIrcMessageFormat(this.Prefix, Ping.CanonicalCommand, ":{0}", this.Message);
}
示例10: Pass
public Pass(string server, Prefix prefix, string password)
{
if (String.IsNullOrWhiteSpace(server)) throw new ArgumentException("Null or whitespace string", "server");
if (prefix == null) throw new ArgumentNullException("prefix");
if (String.IsNullOrWhiteSpace(password)) throw new ArgumentException("Null or whitespace string", "password");
this.server = server;
this.prefix = prefix;
this.password = password;
this.ircMessage = Common.CreateIrcMessageFormat(this.Prefix, Pass.CanonicalCommand, "{0}", this.Password);
}
示例11: List
public List(string server, Prefix prefix, IImmutableList<string> channels)
{
if (String.IsNullOrWhiteSpace(server)) throw new ArgumentException("Null or whitespace string", "server");
if (prefix == null) throw new ArgumentNullException("prefix");
if (channels == null) throw new ArgumentNullException("channels");
if (channels.Count == 0 || channels.Any(c => String.IsNullOrWhiteSpace(c))) throw new ArgumentException("Empty channel list or list contains an empty element.", "channels");
this.server = server;
this.prefix = prefix;
this.channels = channels;
this.ircMessage = Common.CreateIrcMessageFormat(prefix, List.CanonicalCommand, "{0}", String.Join(",", this.Channels));
}
示例12: Part
public Part(string server, Prefix prefix, IImmutableList<string> destinations)
{
if (String.IsNullOrWhiteSpace(server)) throw new ArgumentException("Null or whitespace string", "server");
if (prefix == null) throw new ArgumentNullException("prefix");
if (destinations == null) throw new ArgumentNullException("destinations");
if (destinations.Count == 0 || destinations.Any(c => String.IsNullOrWhiteSpace(c))) throw new ArgumentException("Empty destination list or list contains an empty element.", "destinations");
this.server = server;
this.prefix = prefix;
this.destinations = destinations;
this.ircMessage = Common.CreateIrcMessageFormat(this.Prefix, Part.CanonicalCommand, "{0}", this.Destinations);
}
示例13: Message
public Message(string server, Prefix prefix, string command, IImmutableList<string> parameters)
{
if (String.IsNullOrWhiteSpace(server)) throw new ArgumentException("String null or empty", "server");
if (prefix == null) throw new ArgumentNullException("prefix");
if (String.IsNullOrWhiteSpace(command)) throw new ArgumentException("String null or empty", "command");
if (parameters == null) throw new ArgumentNullException("parameters");
if (parameters.Any(s => String.IsNullOrWhiteSpace(s))) throw new ArgumentException("Empty or null parameter", "parameters");
this.server = server;
this.prefix = prefix;
this.command = command;
this.parameters = parameters;
}
示例14: EqualityTest
public void EqualityTest()
{
var p1 = new Prefix(_prefixConfig, "DEV", "iphone");
var p2 = new Prefix(_prefixConfig, "DEV");
var p3 = new Prefix(_prefixConfig, "stageB");
var p4 = new Prefix(_prefixConfig, "DEV", "iphone");
Assert.IsTrue(p1.CompareTo(p2) > 0);
Assert.IsTrue(p1.CompareTo(p3) > 0);
Assert.IsTrue(p2.CompareTo(p3) > 0);
Assert.AreNotEqual(p1, p2);
Assert.AreEqual(p1, p4);
}
示例15: Parse
/// <summary>
/// Parses strings like:
/// PFX A 0 re .
/// </summary>
/// <param name="data"></param>
/// <returns>null if parsing failes</returns>
public static Prefix Parse(string[] data)
{
if (data.Length != 5)
return null;
if (data[0] != "PFX")
return null;
Prefix pfx = new Prefix ();
if (!pfx.ParseData (data))
return null;
return pfx;
}