Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: Still fighting with the terminologies of unicode vs. encoding Pin
JustWatchLittle 16-Dec-17 6:07
professionalJustWatchLittle 16-Dec-17 6:07 
SuggestionRe: Still fighting with the terminologies of unicode vs. encoding Pin
Richard Deeming18-Dec-17 2:19
mveRichard Deeming18-Dec-17 2:19 
GeneralRe: Still fighting with the terminologies of unicode vs. encoding Pin
PIEBALDconsult18-Dec-17 12:01
mvePIEBALDconsult18-Dec-17 12:01 
QuestionAdvice on Partial View Pin
sunsher16-Dec-17 0:36
sunsher16-Dec-17 0:36 
AnswerRe: Advice on Partial View Pin
Richard MacCutchan16-Dec-17 0:47
mveRichard MacCutchan16-Dec-17 0:47 
QuestionConvert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 1:39
arnold_w14-Dec-17 1:39 
AnswerRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
Richard Deeming14-Dec-17 2:39
mveRichard Deeming14-Dec-17 2:39 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 3:15
arnold_w14-Dec-17 3:15 
I have re-arranged the code a little to make it easier to spot the compile errors:
30      
31                  List<Record> UnsortedRecords = new List<Record>();
32                  UnsortedRecords.Add(new Record("City",   "Florida",    "Miami"));
33                  // The rest of the adds are removed in order to compact the code
34       
35                  List<Record> SortedRecords = SortRecords(UnsortedRecords);
36              }
37      
38              // You can either replace the ArrayList with a List<T>[^], or use the Cast[^] or OfType[^] 
39              // methods to convert it to an IEnumerable<T>.
40              public static IEnumerable<Record> SortRecords(IEnumerable<Record> source)
41              {
42                  IEnumerable<IEnumerable<Record>> groupT = System.Linq.Enumerable.GroupBy<Record, string, IEnumerable<Record>>
43                      (source,
44                      delegate(Record r) { return r.column1; },
45                      delegate(
46                      string key, IEnumerable<Record> items)
47                      {
48                          IEnumerable<System.Linq.IGrouping<string, Record>> groupH = System.Linq.Enumerable.GroupBy<Record, string>(items, delegate(Record r) { return r.column2; });
49                          return System.Linq.Enumerable.SelectMany<IEnumerable<Record>, 
50                              Record>(groupH, 
51                              delegate(IEnumerable<Record> g) { 
52                                     return g; });
53                      });
54      
55                  return System.Linq.Enumerable.SelectMany<IEnumerable<Record>, Record>(groupT, delegate(IEnumerable<Record> g) { return g; });
56              }
57          }
58      }


I get the following 5 compile errors:

Line 35: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<sort.form1.record>' to 'System.Collections.Generic.List<sort.form1.record>'. An explicit conversion exists (are you missing a cast?)

Line 43: The best overloaded method match for 'System.Linq.Enumerable.GroupBy<sort.form1.record,string,system.collections.generic.ienumerable<sort.form1.record>>(System.Collections.Generic.IEnumerable<sort.form1.record>, System.Func<sort.form1.record,string>, System.Func<sort.form1.record,system.collections.generic.ienumerable<sort.form1.record>>)' has some invalid arguments

Line 45: Argument '3': cannot convert from 'anonymous method' to 'System.Func<sort.form1.record,system.collections.generic.ienumerable<sort.form1.record>>'

Line 50: The best overloaded method match for 'System.Linq.Enumerable.SelectMany<system.collections.generic.ienumerable<sort.form1.record>,Sort.Form1.Record>(System.Collections.Generic.IEnumerable<system.collections.generic.ienumerable<sort.form1.record>>, System.Func<system.collections.generic.ienumerable<sort.form1.record>,System.Collections.Generic.IEnumerable<sort.form1.record>>)' has some invalid arguments

Line 50: Argument '1': cannot convert from 'System.Collections.Generic.IEnumerable<system.linq.igrouping<string,sort.form1.record>>' to 'System.Collections.Generic.IEnumerable<system.collections.generic.ienumerable<sort.form1.record>>'
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
Richard Deeming14-Dec-17 3:30
mveRichard Deeming14-Dec-17 3:30 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 4:14
arnold_w14-Dec-17 4:14 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 5:19
arnold_w14-Dec-17 5:19 
SuggestionRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
Richard Deeming14-Dec-17 6:17
mveRichard Deeming14-Dec-17 6:17 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
BillWoodruff15-Dec-17 11:06
professionalBillWoodruff15-Dec-17 11:06 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w15-Dec-17 20:29
arnold_w15-Dec-17 20:29 
QuestionNeed to understand work assigned to me Pin
nisss13-Dec-17 20:13
nisss13-Dec-17 20:13 
AnswerRe: Need to understand work assigned to me Pin
OriginalGriff13-Dec-17 20:36
mveOriginalGriff13-Dec-17 20:36 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 0:11
nisss14-Dec-17 0:11 
GeneralRe: Need to understand work assigned to me Pin
OriginalGriff14-Dec-17 0:32
mveOriginalGriff14-Dec-17 0:32 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 0:52
nisss14-Dec-17 0:52 
GeneralRe: Need to understand work assigned to me Pin
OriginalGriff14-Dec-17 1:06
mveOriginalGriff14-Dec-17 1:06 
GeneralRe: Need to understand work assigned to me Pin
jschell14-Dec-17 8:52
jschell14-Dec-17 8:52 
AnswerRe: Need to understand work assigned to me Pin
Richard MacCutchan13-Dec-17 21:33
mveRichard MacCutchan13-Dec-17 21:33 
GeneralRe: Need to understand work assigned to me Pin
jschell14-Dec-17 8:51
jschell14-Dec-17 8:51 
GeneralRe: Need to understand work assigned to me Pin
Richard MacCutchan14-Dec-17 9:27
mveRichard MacCutchan14-Dec-17 9:27 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 20:39
nisss14-Dec-17 20:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.