Click here to Skip to main content
15,561,980 members
Home / Discussions / C#
   

C#

 
GeneralRe: Still fighting with the terminologies of unicode vs. encoding Pin
JustWatchLittle 16-Dec-17 7:07
professionalJustWatchLittle 16-Dec-17 7:07 
SuggestionRe: Still fighting with the terminologies of unicode vs. encoding Pin
Richard Deeming18-Dec-17 3:19
mveRichard Deeming18-Dec-17 3:19 
GeneralRe: Still fighting with the terminologies of unicode vs. encoding Pin
PIEBALDconsult18-Dec-17 13:01
professionalPIEBALDconsult18-Dec-17 13:01 
QuestionAdvice on Partial View Pin
sunsher16-Dec-17 1:36
sunsher16-Dec-17 1:36 
AnswerRe: Advice on Partial View Pin
Richard MacCutchan16-Dec-17 1:47
mveRichard MacCutchan16-Dec-17 1:47 
QuestionConvert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 2:39
arnold_w14-Dec-17 2:39 
AnswerRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
Richard Deeming14-Dec-17 3:39
mveRichard Deeming14-Dec-17 3:39 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 4:15
arnold_w14-Dec-17 4: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 4:30
mveRichard Deeming14-Dec-17 4:30 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 5:14
arnold_w14-Dec-17 5:14 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w14-Dec-17 6:19
arnold_w14-Dec-17 6:19 
SuggestionRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
Richard Deeming14-Dec-17 7:17
mveRichard Deeming14-Dec-17 7:17 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
BillWoodruff15-Dec-17 12:06
professionalBillWoodruff15-Dec-17 12:06 
GeneralRe: Convert .NET 4.5 method into .NET 2.0 using LinqBridge Pin
arnold_w15-Dec-17 21:29
arnold_w15-Dec-17 21:29 
QuestionNeed to understand work assigned to me Pin
nisss13-Dec-17 21:13
nisss13-Dec-17 21:13 
AnswerRe: Need to understand work assigned to me Pin
OriginalGriff13-Dec-17 21:36
mvaOriginalGriff13-Dec-17 21:36 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 1:11
nisss14-Dec-17 1:11 
GeneralRe: Need to understand work assigned to me Pin
OriginalGriff14-Dec-17 1:32
mvaOriginalGriff14-Dec-17 1:32 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 1:52
nisss14-Dec-17 1:52 
GeneralRe: Need to understand work assigned to me Pin
OriginalGriff14-Dec-17 2:06
mvaOriginalGriff14-Dec-17 2:06 
GeneralRe: Need to understand work assigned to me Pin
jschell14-Dec-17 9:52
jschell14-Dec-17 9:52 
AnswerRe: Need to understand work assigned to me Pin
Richard MacCutchan13-Dec-17 22:33
mveRichard MacCutchan13-Dec-17 22:33 
GeneralRe: Need to understand work assigned to me Pin
jschell14-Dec-17 9:51
jschell14-Dec-17 9:51 
GeneralRe: Need to understand work assigned to me Pin
Richard MacCutchan14-Dec-17 10:27
mveRichard MacCutchan14-Dec-17 10:27 
GeneralRe: Need to understand work assigned to me Pin
nisss14-Dec-17 21:39
nisss14-Dec-17 21: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.