Click here to Skip to main content
15,895,370 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to read a Temperature for August and get the total Aveg just for 29 day instead 31 day ? Pin
Abdalla Ben Omran9-May-19 22:12
Abdalla Ben Omran9-May-19 22:12 
QuestionHow to detect advertisement from a Video File Pin
Member 115186794-May-19 1:40
Member 115186794-May-19 1:40 
AnswerRe: How to detect advertisement from a Video File Pin
OriginalGriff4-May-19 1:54
mveOriginalGriff4-May-19 1:54 
AnswerRe: How to detect advertisement from a Video File Pin
#realJSOP4-May-19 2:39
mve#realJSOP4-May-19 2:39 
GeneralRe: How to detect advertisement from a Video File Pin
OriginalGriff4-May-19 2:44
mveOriginalGriff4-May-19 2:44 
AnswerRe: How to detect advertisement from a Video File Pin
Gerry Schmitz4-May-19 3:06
mveGerry Schmitz4-May-19 3:06 
QuestionHow to get the Average with No LINQ code ! Pin
Abdalla Ben Omran3-May-19 4:19
Abdalla Ben Omran3-May-19 4:19 
AnswerRe: How to get the Average with No LINQ code ! Pin
Eddy Vluggen3-May-19 4:59
professionalEddy Vluggen3-May-19 4:59 
Why without LINQ? And why does your example already contain a LINQ-statement, if you want to avoid it?

C#
using System;
using System.Collections.Generic;
					
public class Program
{
	public class TheWeather
    {
        public DateTime dateTime { get; set; } // WHY?? give it a decent name,
                                               // don't use the type-name
        public double Actual_mean_temp { get; set; }
        public double Record_min_temp { get; set; }
        public double Record_max_temp { get; set; }
        public double Actual_precipitation { get; set; }

    }
	public static TheWeather GetAverageForMonth(List<TheWeather> entries, int year, int month)
    {
        TheWeather GetItem = entries[0]; // .First();

        return GetItem;
    }
	public void Main()
	{
		List<TheWeather> wl = new List<TheWeather>();
		wl.Add(new TheWeather() {Actual_mean_temp = 10});
		wl.Add(new TheWeather() {Actual_mean_temp = 20});
		
		double sum = 0; int cnt = 0;
		for (cnt = 0; cnt < wl.Count ; cnt++)
		{
			sum += wl[cnt].Actual_mean_temp;
			Console.WriteLine(string.Format("item {0}, new avg: {1}", cnt, sum / (cnt + 1)));
		}
	}
}

Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

GeneralRe: How to get the Average with No LINQ code ! Pin
Abdalla Ben Omran3-May-19 5:29
Abdalla Ben Omran3-May-19 5:29 
GeneralRe: How to get the Average with No LINQ code ! Pin
Eddy Vluggen3-May-19 9:09
professionalEddy Vluggen3-May-19 9:09 
GeneralRe: How to get the Average with No LINQ code ! Pin
Gerry Schmitz3-May-19 6:59
mveGerry Schmitz3-May-19 6:59 
GeneralRe: How to get the Average with No LINQ code ! Pin
OriginalGriff3-May-19 8:01
mveOriginalGriff3-May-19 8:01 
GeneralRe: How to get the Average with No LINQ code ! Pin
Eddy Vluggen3-May-19 23:36
professionalEddy Vluggen3-May-19 23:36 
GeneralRe: How to get the Average with No LINQ code ! Pin
#realJSOP4-May-19 2:41
mve#realJSOP4-May-19 2:41 
AnswerRe: How to get the Average with No LINQ code ! Pin
Richard MacCutchan3-May-19 4:59
mveRichard MacCutchan3-May-19 4:59 
GeneralRe: How to get the Average with No LINQ code ! Pin
Abdalla Ben Omran3-May-19 5:31
Abdalla Ben Omran3-May-19 5:31 
GeneralRe: How to get the Average with No LINQ code ! Pin
Richard MacCutchan3-May-19 5:35
mveRichard MacCutchan3-May-19 5:35 
QuestionHow to read CSV file which the data in File is not clear ! Pin
Abdalla Ben Omran2-May-19 23:12
Abdalla Ben Omran2-May-19 23:12 
AnswerRe: How to read CSV file which the data in File is not clear ! Pin
OriginalGriff2-May-19 23:14
mveOriginalGriff2-May-19 23:14 
AnswerRe: How to read CSV file which the data in File is not clear ! Pin
Richard MacCutchan2-May-19 23:32
mveRichard MacCutchan2-May-19 23:32 
AnswerRe: How to read CSV file which the data in File is not clear ! Pin
BillWoodruff3-May-19 2:42
professionalBillWoodruff3-May-19 2:42 
AnswerRe: How to read CSV file which the data in File is not clear ! Pin
Gerry Schmitz3-May-19 3:52
mveGerry Schmitz3-May-19 3:52 
AnswerRe: How to read CSV file which the data in File is not clear ! Pin
#realJSOP4-May-19 4:49
mve#realJSOP4-May-19 4:49 
QuestionLiterally my first "program", and I'm trying to break it down. Pin
Member 143531442-May-19 13:36
Member 143531442-May-19 13:36 
AnswerRe: Literally my first "program", and I'm trying to break it down. Pin
Member 143531442-May-19 13:44
Member 143531442-May-19 13:44 

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.