本文整理匯總了C#中Novacode.List類的典型用法代碼示例。如果您正苦於以下問題:C# List類的具體用法?C# List怎麽用?C# List使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
List類屬於Novacode命名空間,在下文中一共展示了List類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Index
public ActionResult Index()
{
string category = "Computers";
var useperiods = db.UsePeriods
.Where(up => up.EndDate == null || up.EndDate >= DateTime.Now)
.Where(up => up.Asset is Computer)
.OrderBy(up => up.AssetId)
.Select(up => new { AssetId = up.AssetId, Name = up.UserAccount.Name,
Function = up.Function, SerialNumber = up.Asset.SerialNumber })
.ToList()
;
List<AssetSelectListItem> list2 = new List<AssetSelectListItem>();
foreach (var item in useperiods)
{
AssetSelectListItem asli = new AssetSelectListItem();
asli.CompoundId = category.Substring(0, 1) + item.AssetId.ToString();
asli.Identifier = asli.CompoundId + " - ";
if (string.IsNullOrEmpty(item.Name))
{
if (string.IsNullOrEmpty(item.Function))
{
asli.Identifier += item.SerialNumber;
}
else { asli.Identifier += item.Function; }
}
else { asli.Identifier += item.Name; }
list2.Add(asli);
}
ViewBag.CompoundId = new SelectList(list2, "CompoundId", "Identifier");
return View(new RepairInfo());
}
示例2: GetRelatedImplantCostDetail
public virtual List<CostDetail> GetRelatedImplantCostDetail(string codProductPartTask, IQueryable<Cost> costs)
{
List<CostDetail> lst = new List<CostDetail>();
var x = CreatorImplantCostDetail();
x.ComputedBy = this;
x.ProductPart = this.ProductPart;
//devo pescare il costo e associarlo al dettaglio
if (x.CodCost == null)
{
var xxxx = costs.ToList();
var cost = costs.Where(pp => pp.CodProductPartImplantTask == codProductPartTask).FirstOrDefault();
//da non usare MAIIII x.TaskCost = cost;
x.CodCost = cost.CodCost;
x.CodCostDetail = cost.CodCost;
x.CostDetailCostCodeRigen();
}
//GUID
x.Guid = this.Guid;
this.Computes.Add(x);
lst.Add(x);
return lst;
}
示例3: GetFormattedTextRecursive
internal static void GetFormattedTextRecursive(XElement Xml, ref List<FormattedText> alist)
{
FormattedText ft = ToFormattedText(Xml);
FormattedText last = null;
if (ft != null)
{
if (alist.Count() > 0)
last = alist.Last();
if (last != null && last.CompareTo(ft) == 0)
{
// Update text of last entry.
last.text += ft.text;
}
else
{
if (last != null)
ft.index = last.index + last.text.Length;
alist.Add(ft);
}
}
if (Xml.HasElements)
foreach (XElement e in Xml.Elements())
GetFormattedTextRecursive(e, ref alist);
}
示例4: CreateCompanyList2
public static List<ChartData> CreateCompanyList2()
{
List<ChartData> company2 = new List<ChartData>();
company2.Add(new ChartData() { Mounth = "January", Money = 80 });
company2.Add(new ChartData() { Mounth = "February", Money = 160 });
company2.Add(new ChartData() { Mounth = "March", Money = 130 });
return company2;
}
示例5: WfDocGenerator
public WfDocGenerator(List<ActivityChainModel> activities, RulesExtractor rulesExtractor, Settings Settings)
: base(activities, rulesExtractor, Settings)
{
if (Settings.GetLanguage() < OutputFormat.Docx)
throw new NotSupportedException("Output Language not supported:" + Settings.GetLanguage());
Name = "Workflow to Code Generator";
}
示例6: CreateCompanyList1
public static List<ChartData> CreateCompanyList1()
{
List<ChartData> company1 = new List<ChartData>();
company1.Add(new ChartData() { Mounth = "January", Money = 100 });
company1.Add(new ChartData() { Mounth = "February", Money = 120 });
company1.Add(new ChartData() { Mounth = "March", Money = 140 });
return company1;
}
示例7: Terminos_y_resultado
public Terminos_y_resultado(List<float> results, List<string> cats, float indice, float calif)
{
InitializeComponent();
this.results = results;
this.cats = cats;
this.bigcats = new List<float>();
this.indice = indice;
this.calif = calif;
}
示例8: GetParagraphs
internal List<Paragraph> GetParagraphs()
{
// Need some memory that can be updated by the recursive search.
int index = 0;
List<Paragraph> paragraphs = new List<Paragraph>();
GetParagraphsRecursive(Xml, ref index, ref paragraphs);
return paragraphs;
}
示例9: AddParagraph
/// <summary>
///
/// </summary>
/// <param name="lines"></param>
/// <param name="doc"></param>
public static void AddParagraph(List<List<string>> lines, DocX doc)
{
Paragraph p = doc.InsertParagraph();
List<List<string>> l = lines;
foreach (List<string> ss in l)
{
MatchCollection mc = Regex.Matches(ss[0], @"\{[0-9]+\}");
string temp = ss[0];
foreach (Match m in mc)
{
foreach (Capture c in m.Captures)
{
temp = temp.Replace(c.Value, "¬");
}
}
string[] temps = temp.Split('¬');
Append(p, temps[0]);
for (int i = 1; i < ss.Count; i++)
{
string pattern = @"\\(?<type>[a-zA-Z0-9]+)(?:\{(?<output>[^\{\}]+)\})?(?:\{(?<output2>[^\{\}]+)\})?";
Match m = Regex.Match(ss[i], pattern);
switch (m.Groups["type"].Value)
{
case "textbf":
Append(p, m.Groups["output"].Value);
p.Bold();
p.Append(temps[i]);
break;
case "emph":
case "textit":
Append(p, m.Groups["output"].Value);
p.Italic();
Append(p, temps[i]);
break;
case "rlap":
Append(p, m.Groups["output"].Value);
Append(p, m.Groups["output2"].Value);
break;
default:
throw new Exception(m.Groups["type"] + " is still under development");
}
}
string blah = doc.Xml.Value;
}
}
示例10: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
ArrayList düzeltilmisler = new ArrayList();
string[] array = new string[] { };
StreamWriter docx = File.CreateText(@"C:\Users\" + Environment.UserName + @"\Documents\" + DosyaAdi + ".txt");
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
Document doc = new Document();
// Define an object to pass to the API for missing parameters
object missing = System.Type.Missing;
doc = word.Documents.Open(ref DosyaYolu,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
String read = string.Empty;
List<string> data = new List<string>();
foreach (Range tmpRange in doc.StoryRanges)
{
//read += tmpRange.Text + "<br>";
read += tmpRange.Text;
}
((_Document)doc).Close();
((_Application)word).Quit();
array = read.Split(new Char[] { ',',' ', '_','-','.','"',';',':', '“', '”','!','(',')','[',']','{','}' });
for (int i = 0; i < array.Length; i++)
{
düzeltilmisler.Add(Denetim.Düzelt(array[i].Trim()));
backgroundWorker1.ReportProgress((i + 1) * 100 / array.Length);
}
for (int i = 0; i < düzeltilmisler.Count; i++)
{
try
{
if((string)düzeltilmisler[i] != array[i].ToLower().Trim())
{
docx.WriteLine(array[i].ToLower() + " -> " + düzeltilmisler[i]);
}
}
catch (Exception e2)
{
}
}
docx.Close();
}
示例11: Csapatok
public Csapatok( string versenyAzonosito ) {
csapatok = new List<Csapat>( );
foreach( var versenyeredmenyek in Model.Data.Data.Eredmenyek._versenyEredmenyek.Where( eredmeny => eredmeny.VersenyAzonosito.Equals( versenyAzonosito ) ) ) {
foreach( var csapatazonosito in versenyeredmenyek.Eredmenyek._eredmenyek.OrderBy( eredmeny => eredmeny.Csapat ).GroupBy( eredmeny => eredmeny.Csapat ).Select( grouping => grouping.Key ) ) {
csapatok.Add( new Csapat {
Azonosito = csapatazonosito,
InduloAdatok = new InduloAdatok( versenyAzonosito, csapatazonosito )
} );
}
}
}
示例12: Terminos_y_resultado_Load
private void Terminos_y_resultado_Load(object sender, EventArgs e)
{
float result = 0;
int contador = 0;
List<int> fin = new List<int>();
for (int i = 0; i < cats.Count; i++)
{
if (i > 0)
{
if (cats.ElementAt(i).Contains("--"))
{
contador++;
}
else
{
fin.Add(contador);
contador = 0;
}
if (i == cats.Count - 1)
fin.Add(contador);
}
}
result = 0;
int pos = 0;
int parainsertar = 0;
for (int i = 0; i < fin.Count; i++)
{
for (int j = 0; j < fin.ElementAt(i); j++)
{
result += results.ElementAt(pos + j);
}
results.Insert(parainsertar, result);
result = 0;
if (pos == 0)
pos += fin.ElementAt(i) + 1;
else
pos += fin.ElementAt(i);
parainsertar += fin.ElementAt(i) + 1;
}
Resultadofinal.Text = indice.ToString();
Idesempeño.Text = calif.ToString();
richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, 16);
for (int i = 0; i < cats.Count; i++)
richTextBox1.Text += cats.ElementAt(i) + ": " + results.ElementAt(i).ToString() + "\n";
}
示例13: SelectValidpHint
public virtual List<PrintingHint> SelectValidpHint(List<PrintingHint> pHint, double smallerCalculatedDCutLessZero, double smallerCalculatedDCut)
{
List<PrintingHint> pHint1;
pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= this.MinDCut
&& x.DCut2 <= this.MaxDCut && (x.DCut1 >= x.DCut2 || (x.DCut1 == 0 && x.MaxGain1 == 1)))).ToList();
var c = pHint1.Where(y => !y.IsDie);
if (c.Count() == 0 || MinDCut == 0)
{
//fascette gommate
if (MinDCut == 0 && MaxDCut == 0)
{
var pHint2 = pHint.Where(x => x.IsDie || (x.DCut2 == smallerCalculatedDCutLessZero * -1));
pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0))).ToList();
var pHint3 = pHint1.Union(pHint2);
pHint1 = pHint3.ToList();
}
else
{
var smaller = pHint.Where(x => x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1).Select(x => x.DeltaDCut2).Min();
var pHintLast1 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));
try
{
var smaller2 = pHint.Where(x => (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1) && x.DeltaDCut2 != smaller).Select(x => x.DeltaDCut2).Min();
var pHintLast2 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller2 && x.DeltaDCut2 != smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));
pHint1 = pHintLast1.Union(pHintLast2).ToList();
}
catch (Exception)
{
pHint1 = pHintLast1.ToList();
}
// pHint1 = pHint.Where(x => x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0)).ToList();
}
}
var pRemove = pHint1.Select(x => x.BuyingFormat.GetSide1() == 0);
Console.WriteLine(pRemove);
pHint1 = pHint1.Where(x => x.GainOnSide2 > 0 && x.GainOnSide1 > 0).ToList();
return pHint1.Where(x => x.BuyingFormat.GetSide1() != 0).ToList();
}
示例14: WriteToFile
public void WriteToFile(string fileName, List<Problem> source, int numberOfPage)
{
DocX doc = DocX.Create(fileName);
var font = new System.Drawing.FontFamily("Consolas");
var rand = new Random(DateTime.Now.Millisecond);
var gap = new string(' ', spaceBetweenProblem - 1);
var totalCount = colCount * rowCount * numberOfPage;
List<Problem> allItems = new List<Problem>();
while (allItems.Count < totalCount)
{
var problems = source.ToArray();
Utils.Shuffle(problems);
allItems.AddRange(problems);
}
Paragraph lastLine = null;
for (int page = 0; page < numberOfPage; page++)
{
var from = colCount * rowCount * page;
for (int row = 0; row < rowCount; row++)
{
var line1 = doc.InsertParagraph();
lastLine = doc.InsertParagraph();
for (int col = 0; col < colCount; col++)
{
line1.Append(string.Format("{0} ", allItems[from].LeftNumber.ToString().PadLeft(maxDigits + 1, ' '))).Font(font).FontSize(fontSize).Append(gap).Font(font).FontSize(fontSize);
lastLine.Append(string.Format("{0}{1} ", allItems[from].Sign, allItems[from].RightNumber.ToString().PadLeft(maxDigits, ' '))).Font(font).FontSize(fontSize).UnderlineStyle(UnderlineStyle.thick).Append(gap).Font(font).FontSize(fontSize);
from++;
}
if (row != rowCount - 1)
{
for (int i = 0; i < spaceLinesBetweenItem; i++)
{
lastLine = doc.InsertParagraph();
}
}
}
if (page != numberOfPage - 1 && addPageBreak)
{
lastLine.InsertPageBreakAfterSelf();
}
}
doc.Save();
}
示例15: Flatten
public static void Flatten(this XElement e, XName name, List<XElement> flat)
{
// Add this element (without its children) to the flat list.
XElement clone = CloneElement(e);
clone.Elements().Remove();
// Filter elements using XName.
if (clone.Name == name)
flat.Add(clone);
// Process the children.
if (e.HasElements)
foreach (XElement elem in e.Elements(name)) // Filter elements using XName
elem.Flatten(name, flat);
}