DateTime minStartTime =
ListOfProcesesForKilling.Min( p => {
return p.StartTime;
} );
value += $"Min starttime: {minStartTime};";
Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
Showing posts with label c# - List. Show all posts
Showing posts with label c# - List. Show all posts
Tuesday, November 4, 2025
c# - How to call Min(), Max() on generic List
Friday, November 24, 2023
c#, devexpress - How to make master-detail relation on non-DB objects (List generic )
List<TmpParent> list = new List<TmpParent>(); List<TmpChild> listChildExternal = new List<TmpChild>();Initial data filling:
var p = new TmpParent( "A", "A", true );
p.listInner.Add( new TmpChild() );
list.Add( p );
list.Add( new TmpParent( "B", "B", false, TypeEnum.OPERATOR ) );
list.Add( new TmpParent( "C", "C", true ) );
list.Add( new TmpParent( "D", "D", false ) );
listChildExternal.Add( new TmpChild() { str1="C", str2 = "child1" } );
listChildExternal.Add( new TmpChild() { str1="C", str2 = "child1.1" } );
listChildExternal.Add( new TmpChild() { str1="B", str2 = "child1.2" } );
gridParent.DataSource = list; // master
Find and show detail data:
- First detail list for inner list.
- Second detail list for external list connected with relation.
private void gridViewParent_FocusedRowChanged( object sender,
DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e ) {
if ( e.FocusedRowHandle >= 0 ) {
TmpParent master = gridView1.GetRow( e.FocusedRowHandle ) as TmpParent;
if ( master != null ) {
/* A] try to find in inner list */
gridDetail.DataSource = master.listInner;
/* B] try to find in external list */
gridChildExternal.DataSource =
listChildExternal.Where( x => x.str1 == master.str1 ).ToList();
}
}
}
First grid=master, second grid=detail internal list, third grid=detail external list.
Friday, March 5, 2021
C# - How to initialize List items in new statement
One possibility:
image.Normalize( new ListAnother possibility with setting accessible properties by name:() { new Rectangle( 100, 100, 300, 100 ) } );
image.Normalize( new List() { new Rectangle() { X=100, Y=100, Width=300, Height=100 }, new Rectangle() { X=200, Y=250, Width=200, Height=50 } } );
Friday, December 18, 2020
C# - How to convert short array/list into byte array list
/* source with short values */ public List<short> Data = new List<short>(); ... short[] DataArray = Data.ToArray(); byte[] bufferBytes = new byte[ DataArray.Length * sizeof( short ) ]; Buffer.BlockCopy( DataArray, 0, bufferBytes, 0, bufferBytes.Length ); /* dest with byte values */ Console.WriteLine( bufferBytes[0] + ", " + bufferBytes[1] );If first short value in source list is 313, then first two values in bufferBytes after copy will be 57 (111001) a 1(1).
Tuesday, January 14, 2020
C# - How to sort generic list by item value
private List<ConstellationIndex> ConstellationsIndex = new List<ConstellationIndex>();
...
this.ConstellationsIndex.Sort( (x, y) => x.Constellation.CompareTo( y.Constellation ) );
Thursday, November 21, 2019
C# - List.AddRange() - how copy one List object to another in one row
I have two List:
Node: Import is class, that contains Rows.
List<ObjectCoordinateBase> AllObjects; List<InfoStar> Rows;When I want copy objects from InfoStar class to ObjectCoordinate class, I can use List.AddRange() method.
Node: Import is class, that contains Rows.
Map.AllObjects.AddRange( import.GetAsObjectCoordinateBase() );
And here:public IEnumerable<ObjectCoordinateBase> GetAsObjectCoordinateBase() {
List<ObjectCoordinateBase> list = new List<ObjectCoordinateBase>();
this.Rows.ForEach( item => {
list.Add( new ObjectCoordinateBase( item ) );
} );
return list;
}
Subscribe to:
Posts (Atom)

