nighttrain's Profile User Rating: -----

Reputation: 7 Worker
Active Members
Active Posts:
340 (0.23 per day)
22-September 10
Profile Views:
Last Active:
User is online 18 minutes ago
Viewing Topic: GetEnumerator Basics

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Icon   nighttrain still drilling

Posts I've Made

  1. In Topic: Determinate type of object and pass it through method

    Posted 30 Sep 2014

    Thans baavgai let me conside this application once again i will come back with something better let you know :) thanks again for your help.
  2. In Topic: Determinate type of object and pass it through method

    Posted 29 Sep 2014

    Same as i use my new. Method getkpipaths inside exporttoexcel method. What if i would like also to use it inside execute soap or other method within program class sshould i lso use it like     var statisticPaths = GetKpiPaths(kpi) insie other method and use?

    Second question. You said that only those variables which creating specific object this case class should belong to it which are passes or be created inside constructor but what confusing me is why then specificpaths couldnt not be created inside contrcut and got field jnstead of dynamicky call it as we did in getkoipaths and using it in some other methods? Simple saying how should i know whether to create filed and initilize in constructor or dynamically initialize it in some methods dirctly instead of field and constructor way. Fr instance we created ftp field and also in constructor but this ftp will be not used in all methods inside program but probably only in few methods anyway it s private global field in this class. So why statisticpaths cannot have the same it will be also used in some methods but you marked and confim that its btter to llocate it directly in method, this confusing me i try to understand.
  3. In Topic: Determinate type of object and pass it through method

    Posted 29 Sep 2014

    you know whats my problem lets say i know from meritorical point of view how classes should looks like and so on but i got always problems when it comes to stick it together. For instance when i prepare couple classes e.g FTP, StatisticPath, Logger, Server and so on. Then when it comes to stick it together i mean how to call each other i am confused how to pass they instances to each other then i am most of time "loosing" with accessing variables and so on thats why i am asking when to use diresctly new CLASS() how to pass parameters with no duplication or use already existing once and when to pass instancs of other classes directly to constructor or maybe call it from some method etc... For instance now i wanted to add StatisticPaths based on your code to Program class what i did is:
      class Program
            private readonly string serviceHttpAdress, rootDir;
            private readonly FTP ftp;
            private readonly Logger logger;
            private readonly Server server;
            private StatisticPaths statisticPaths;                        // <---------------------------- added

    and then still inside Program class:
     private void GetKpiPaths(KPIName kpi)                   
                statisticPaths = new StatisticPaths(rootDir, kpi);          // <---------------------------added create statisticPaths for specific KPI

    and then i could use statisticPaths variable inside other methods within Program class is this for instance correct ? For instance (still within Program class:
      public virtual bool ExportToExcel(DataTable dt, KPIName kpi)
    string Filename = statisticPaths.ExcelFP; //<------------------------------------------------------------- here like this

    Let me thiunk about again on this program and i will come with something hope better.
  4. In Topic: Determinate type of object and pass it through method

    Posted 29 Sep 2014

    According to first - it will work check again how i implemented that:

    in class FTP i have provate field:
     private FtpResult _ftpResult;

    and method:
    public FtpResult FtpProcess()
    	            FTP ftpClient = null; // <-----------forget about this is wrong putted
    	            _ftpResult = new FtpResult();
    	                    Logger.Log(LogMsgType.INFO, "Taking data via ftp", LogPath);
    	                    _ftpResult.Download =;

    and inside Statistic class:
     private FTP Ftp { get; set; }
            private FtpResult ftpResult = new FtpResult();   //is it also ok to do like this?

    and method:
       public virtual FtpResult FTP()
    	            Ftp = new FTP(Server.FtpIP, Server.FtpUser, Server.FtpPassword, Server.xml_outputFP + Paths.ResultFileName, Paths.ResultFullPath,
    	                            Paths.ResultFileName, KPIName, Paths.LogPath);
    	            return Ftp.FtpProcess();

    and usage inside CallExecuteSoap:
     ftpResult = FTP();
    	                if (ftpresult.Download == FtpResultTypes.DownloadOk) {

    My main question was is this way correct according to OOP can i implement things to be worked like this i mean mainly about get instance of in this case FTP - inside Statistic class and use it like this? Can i call new instance of FTP this way inside other class to be used within?

    Similar would be as i did also inside Statistic class:
    	private Server GetServer()
    	            return new Server(@"", @"ftp://133.33.333.33/",
    	                      "login", "pass", @"/tmp/rty");

    and then within same Statistic class create it inside cosntructor:
    public Statistic(StatisticPaths paths)
    	            this.Server = GetServer(); <---------------------
    	            this.Paths = paths;
  5. In Topic: Saving and using random number

    Posted 27 Sep 2014

    you can use Shuffle, go ahead and analize this code:

    public static void Shuffle<T>(this IList<T> Mylist)  
        Random rng = new Random();  
        int n = Mylist.Count;  
        while (n > 1) {  
            int r = rng.Next(n + 1);  
            T value = Mylist[r];  
            Mylist[r] = Mylist[n];  
            Mylist[n] = value;  

    List<int> MyOwnList = Enumerable.Range(0, 20).ToList();

    //If it helps vote.

My Information

Member Title:
D.I.C Regular
Age Unknown
Birthday Unknown
Full Name:
Years Programming:
Programming Languages:
VB,NET, C++, C#, PHP, HTML, JS, CSS, Pascal,

Contact Information

Click here to e-mail me
ICQ  637172526



Page 1 of 1
  1. Photo

    FlashM Icon

    24 Sep 2010 - 14:17
    no problem... you're welcome anytime...
Page 1 of 1