Click here to Skip to main content
15,115,504 members

Comments by Alexander Sharykin (Top 10 by date)

Alexander Sharykin 12-Nov-14 2:07am View
   
Reason for my vote of 1 \n Did you really explain anything? I don't think so.
The only way to use this tip&trick is to do a great amount of "copy-paste" operations, which should be avoided.
Alexander Sharykin 16-Oct-14 5:16am View
   
Reason for my vote of 2 \n time chooser looks fine and works correct, but TimeChooser class is too long (12345 rows only for functionality of color switching. even resize is not supported). it definitely needs refactoring. custom drawing should work fine.
Alexander Sharykin 30-Sep-14 4:13am View
   
Reason for my vote of 1 \n LINQ method Join() EXists
Alexander Sharykin 27-Jun-14 3:00am View
   
Reason for my vote of 3 \n your where() extension measurement is incorrect. you forgot about one cool LINQ feature - Deferred Execution. and in examples 2 linqRows ARE NOT ENUMERATED so you get less than 1 second results.
in example 3 linqRows are enumerated, so it took much longer time. I suppose ElementAt(0) works fine

some thoughts:
why not to use Dictionary <string, DescrRow> and just pick up description by name: var descr = dict[name]; ?
Alexander Sharykin 27-Jun-14 2:35am View
   
Reason for my vote of 2 \n your select() and where() extensions measurements are incorrect. you forgot about one cool LINQ feature - Deferred Execution. and in examples 1 and 2 selectRows and linqRows ARE NOT ENUMERATED so you get less than 1 second results.
in example 3 linqRows are enumerated, so it takes much longer time. I suppose ElementAt(0) works fine
most time in select example was taken by string.Format and cast operations, in where example - by string.Format

some thoughts:
why not to use Dictionary <string, DescrRow> and just pick up description by name: var descr = dict[name]; ?
Alexander Sharykin 10-Jun-14 2:16am View
   
it will, because example 2 is an Exception situation
try to use any of StackOverflow solution
I would suggest to create DataTable and fill it with data from _db.UserProfiles as the easies variant
smth like this:
var list = _db.UserProfiles.OrderBy(r => r.Family).ToList();
var dt = new DataTable();
dt.Columns.Add("Name");
foreach(var user in list)
dt.Rows.Add(user.Name);
dgvList.DataSource = dt;
Alexander Sharykin 12-May-14 2:12am View
   
Reason for my vote of 2 \n Examles are obsolete since .Net 3.5 when LINQ was released
Does this tip give anything new what can't be found in MSDN?
Func<t, tresult=""> delegate
Alexander Sharykin 27-Feb-14 0:39am View
   
if you execute a stored procedure or a function in this command, it is possible to organize a feedback and update progress in your application
but it won't work in case of a single update or delete query
Alexander Sharykin 13-Dec-13 8:30am View
   
key should be unique for each node, and in case of department hierarchy this approach works.
and what if someone want to display departments - employees relationship?
it may happen that a department and an employee has the same Id
Alexander Sharykin 13-Dec-13 3:14am View
   
this is definitely a bad idea to rely on any view properties (such as cell color) in your business logic
though "column index is not permanent", it's possible to know day of week.
variant of solution
int year = 2013;
int month = 12;
var dt = new DateTime(year, month, e.ColumnIndex);
if (dt.DayOfWeek == DayOfWeek.Saturday)
e.ToolTipText = "Sunday";