Click here to Skip to main content
15,915,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: References to an object Pin
S. Senthil Kumar11-Mar-07 15:02
S. Senthil Kumar11-Mar-07 15:02 
GeneralRe: References to an object Pin
Scott Dorman11-Mar-07 15:32
professionalScott Dorman11-Mar-07 15:32 
GeneralRe: References to an object Pin
Zoltan Balazs11-Mar-07 17:31
Zoltan Balazs11-Mar-07 17:31 
GeneralRe: References to an object Pin
Scott Dorman11-Mar-07 17:49
professionalScott Dorman11-Mar-07 17:49 
AnswerRe: References to an object Pin
Guffa11-Mar-07 16:26
Guffa11-Mar-07 16:26 
GeneralRe: References to an object Pin
Zoltan Balazs11-Mar-07 17:41
Zoltan Balazs11-Mar-07 17:41 
GeneralRe: References to an object Pin
Zoltan Balazs12-Mar-07 7:15
Zoltan Balazs12-Mar-07 7:15 
QuestionHow to assign value to generic list member Pin
AndrusM11-Mar-07 10:46
AndrusM11-Mar-07 10:46 
I need to assign loop variable value to GroupList Footer member
in foreach loop.
I tried code above but got error

Cannot modify the return value of
'System.Collections.Generic.List<mynsp.reportband.group>.this[int]' because it is not a variable

How to fix this error ?


using System.Collections.Generic;

static class Program {
	static void Main() {
	}
}

public class ReportBandEntity { public int objcode, foo,bar; };

public class ReportBand {

	public List<ReportBandEntity> EntityList;

	// ... EntityList initialization code skipped

	public struct Group {
		public ReportBandEntity Header, Footer;
	}

	public List<Group> GroupList;

	public void GetGroupList() {

		GroupList = new List<Group>();

		foreach (ReportBandEntity e in EntityList)
			if (e.objcode == 1) {
				Group g = new Group();
				g.Header = e;
				GroupList.Add(g);
			}

		int i = 0;
		foreach (ReportBandEntity e in EntityList)
			if (e.objcode == 2) {
				//Error	2	Cannot modify the return value of 
				// 'System.Collections.Generic.List<mynsp.ReportBand.Group>.
				// this[int]' because it is not a variable	

				GroupList[i++].Footer = e;

				// this does not cause error but does not assign value to
				// GroupList[i++].Footer !
				//Group x = GroupList[i++];
				//x.Footer = e;
			}
	}
}


Andrus

AnswerRe: How to assign value to generic list member Pin
S. Senthil Kumar11-Mar-07 14:07
S. Senthil Kumar11-Mar-07 14:07 
QuestionAppDomain + Reflection Pin
AJ12311-Mar-07 9:58
AJ12311-Mar-07 9:58 
AnswerRe: AppDomain + Reflection Pin
S. Senthil Kumar11-Mar-07 14:11
S. Senthil Kumar11-Mar-07 14:11 
QuestionDataGridView IDENTITY column binding problem Pin
Deian11-Mar-07 9:13
Deian11-Mar-07 9:13 
AnswerRe: DataGridView IDENTITY column binding problem Pin
Deian11-Mar-07 11:31
Deian11-Mar-07 11:31 
Questionsimple 2d graphics with c# Pin
liquidfluid11-Mar-07 8:35
liquidfluid11-Mar-07 8:35 
AnswerRe: simple 2d graphics with c# Pin
Ed.Poore11-Mar-07 8:50
Ed.Poore11-Mar-07 8:50 
Questionmarshaling of the const char * Pin
MinaFawzi11-Mar-07 6:21
MinaFawzi11-Mar-07 6:21 
AnswerRe: marshaling of the const char * Pin
Ed.Poore11-Mar-07 7:52
Ed.Poore11-Mar-07 7:52 
QuestionPassing member variables as private method arguments? Pin
David Veeneman11-Mar-07 5:38
David Veeneman11-Mar-07 5:38 
AnswerRe: Passing member variables as private method arguments? Pin
S. Senthil Kumar11-Mar-07 5:55
S. Senthil Kumar11-Mar-07 5:55 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman11-Mar-07 7:32
David Veeneman11-Mar-07 7:32 
AnswerRe: Passing member variables as private method arguments? Pin
Christian Graus11-Mar-07 4:55
protectorChristian Graus11-Mar-07 4:55 
AnswerRe: Passing member variables as private method arguments? Pin
Leslie Sanford11-Mar-07 16:52
Leslie Sanford11-Mar-07 16:52 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman11-Mar-07 7:36
David Veeneman11-Mar-07 7:36 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman12-Mar-07 4:14
David Veeneman12-Mar-07 4:14 
QuestionGenerate Panel Pin
shamsteady11-Mar-07 5:35
shamsteady11-Mar-07 5:35 

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.