Mike Askew 131 Veteran Poster Featured Poster

I bet it is most likely only myself that keeps falling into this.

Its noticed to me that more old threads seem to be ressed for no reason by people and I have a habit of not looking at when they were posted :D

Would it not be easier to resolve the whole graveyard ressing thing by locking out posts after a certain amount of time?

Because I highly doubt new valuable information is going to be added to a post 4 years after it was written, and it someone else asks a question, hi-jacking the thread, they may as well be forced to ask a new one and maybe reference the old thread.

Mike Askew 131 Veteran Poster Featured Poster

Not until you mentioned it no, I dont tend to look at the age. I probably should with the increasing number of fools spamming topics and grave ressing them.

Mike Askew 131 Veteran Poster Featured Poster

See my response on here: http://www.daniweb.com/software-development/csharp/threads/432707/help-with-linking-ids-to-show-in-listview-below

It is a similar question.

Listboxes have the ability to store different values underlying to what the user sees and utilising this will make the retrieving of data alot easier.

Mike Askew 131 Veteran Poster Featured Poster

Hi Mark,

You would need to set up the first list so that the .SelectedItem in list box (What you can physically see) is as you state above, but the .SelectedValue contains the actual ID value.

Then the SQL can adjust too:
SELECT ID,QTY,Description,Supplier,Date,Cost,Sell from cashOrders INNER JOIN cashCustomers ON cashOrders.cashAccountRef_FKID=cashCustomers.CashAccRef WHERE cashCustomers.CashAccRef = " + listview1.SelectedValue;

Havent tested this so the SQL might not work but thats the jist of it. It basically selects all the required information from the cashOrders table based on the Id linked to the cashCustomers table where we compare that to the passed ID value from the .SelectedValue of the listbox1.

In terms of binding the listbox to get the information working correctly, if I remember rightly, it is done by binding the listbox to the datasource and then specifying which columns are the .DisplayMember (is visually seen) and .DataSource.

That probably isnt explained clearly as its been about a year since I've done such xD

This might help explain it also.

Mike Askew 131 Veteran Poster Featured Poster

plz do suggest ne good topic for final year project in .net . Right now i am a beginner in c# .

@'Stein

Please do suggest any good topic for my final year project in .Net, right now I am a beginner in C#.

@Martand

All of what Stein said is true.

My question, how are you a beginner in C# yet doing a final year project? Surely would've learnt another .Net language on your journey to final year and so surely using that is better.

Mike Askew 131 Veteran Poster Featured Poster
        string inputString = "nesa<tab><tab>pera<tab><tab><tab><tab>nn<tab><tab><tab><tab><tab><tab>kkn";
        string regexMatch = "(<tab>){2,20}";
        string regexReplace = "<tab>";
        string outputString;

        outputString = Regex.Replace(inputString, regexMatch, regexReplace);
Mike Askew 131 Veteran Poster Featured Poster

Specifically for <tab>

Match: (<tab>){2,20}
Replace: <tab>

This will match occurances of <tab> between 2 and 20 in a row, can adjust as needed. Works on your provided example though.

Input: nesa<tab><tab>pera<tab><tab><tab><tab>nn<tab><tab><tab><tab><tab><tab>kkn
Output: nesa<tab>pera<tab>nn<tab>kkn

Mike Askew 131 Veteran Poster Featured Poster
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes" method ="text"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match ="root">
    <xsl:apply-templates select="x/y">
      <!-- Year -->
      <xsl:sort select="substring(date, 1, 4)" data-type="number" order="descending"/>
      <!-- Month -->
      <xsl:sort select="substring(date, 6, 2)" data-type="number" order="descending"/>
      <!-- Day -->
      <xsl:sort select="substring(date, 9, 2)" data-type="number" order="descending"/>
      <!-- Hour -->
      <xsl:sort select="substring(date, 12, 2)" data-type="number" order="descending"/>
      <!-- Minute -->
      <xsl:sort select="substring(date, 15, 2)" data-type="number" order="descending"/>
      <!-- Second -->
      <xsl:sort select="substring(date, 18, 2)" data-type="number" order="descending"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="y">
    <xsl:value-of select="uri"/>
    <xsl:text>&#0010;</xsl:text>
  </xsl:template>

</xsl:stylesheet>

Have to break down the date string into individual numbers due to XSLT 1.0 only being able to compare numbers and text.

Mike Askew 131 Veteran Poster Featured Poster

Ok firstly,

With the information contained within the <Para> tag, is that always in that format (for demonstration of point are the parts in caps lock always there?) 'NameX AND NameY ARE EQUAL CONTRIBUTORS' because if they are not ripping variable values from a text string isnt fun.

Mike Askew 131 Veteran Poster Featured Poster

http://www.w3.org/TR/xslt#key

The key is used to match the unique date entries. For example when applied to your example data, select="historicalObservation[generate-id()=generate-id(key('keyByID', observationDate)[1])]" returns nodes #1 and #5, the two start nodes of date blocks, from which I know the next three nodes are the others related to the selected date.

Mike Askew 131 Veteran Poster Featured Poster

Was a pain to do at first but learnt something new from it. The following is a tad messy but works.

It allows the weighting to be in any order within the block of four nodes and it will sort it out.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes" method ="text"/>
  <xsl:strip-space elements="*"/>

  <xsl:key name="keyByID" match="historicalObservation" use="observationDate"/>

  <xsl:template match="/">
    <xsl:text>Date&#9;&#9;Rate1&#9;Rate2&#9;Rate3&#9;Rate4&#0010;</xsl:text>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="input">
    <xsl:for-each select="historicalObservation[generate-id()=generate-id(key('keyByID', observationDate)[1])]">

      <xsl:variable name="RateOne">
        <xsl:if test ="./observationWeight = 1">
          <xsl:value-of select="./observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[1]/observationWeight = 1">
          <xsl:value-of select="following-sibling::historicalObservation[1]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[2]/observationWeight = 1">
          <xsl:value-of select="following-sibling::historicalObservation[2]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[3]/observationWeight = 1">
          <xsl:value-of select="following-sibling::historicalObservation[3]/observedRate"/>
        </xsl:if>
      </xsl:variable>
      <xsl:variable name="RateTwo">
        <xsl:if test ="./observationWeight = 2">
          <xsl:value-of select="./observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[1]/observationWeight = 2">
          <xsl:value-of select="following-sibling::historicalObservation[1]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[2]/observationWeight = 2">
          <xsl:value-of select="following-sibling::historicalObservation[2]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[3]/observationWeight = 2">
          <xsl:value-of select="following-sibling::historicalObservation[3]/observedRate"/>
        </xsl:if>
      </xsl:variable>
      <xsl:variable name="RateThree">
        <xsl:if test ="./observationWeight = 3">
          <xsl:value-of select="./observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[1]/observationWeight = 3">
          <xsl:value-of select="following-sibling::historicalObservation[1]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[2]/observationWeight = 3">
          <xsl:value-of select="following-sibling::historicalObservation[2]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[3]/observationWeight = 3">
          <xsl:value-of select="following-sibling::historicalObservation[3]/observedRate"/>
        </xsl:if>
      </xsl:variable>
      <xsl:variable name="RateFour">
        <xsl:if test ="./observationWeight = 4">
          <xsl:value-of select="./observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[1]/observationWeight = 4">
          <xsl:value-of select="following-sibling::historicalObservation[1]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[2]/observationWeight = 4">
          <xsl:value-of select="following-sibling::historicalObservation[2]/observedRate"/>
        </xsl:if>
        <xsl:if test ="following-sibling::historicalObservation[3]/observationWeight = 4">
          <xsl:value-of select="following-sibling::historicalObservation[3]/observedRate"/>
        </xsl:if>
      </xsl:variable>

      <xsl:value-of select ="./observationDate"/>
      <xsl:text>&#9;</xsl:text>
      <xsl:value-of select="$RateOne"/>
      <xsl:text>&#9;</xsl:text>
      <xsl:value-of select="$RateTwo"/>
      <xsl:text>&#9;</xsl:text>
      <xsl:value-of select="$RateThree"/>
      <xsl:text>&#9;</xsl:text>
      <xsl:value-of select="$RateFour"/>
      <xsl:text>&#0010;</xsl:text>
  </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>
Mike Askew 131 Veteran Poster Featured Poster

In your XSD...

change all the xs: to xsl:

and add a reference to xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Your missing that reference and so its saying your referencing a prefix xs which does not exist anywhere. The above is a general reference that I have in ALL of my XSLT files.

Mike Askew 131 Veteran Poster Featured Poster

Ok I shall have a look at it, sorry for the delay in answering also, don't watch the forum as much when not in the office!

Mike Askew 131 Veteran Poster Featured Poster

Two questions.

  1. Will the dates always be so neatly ordered, ie. all four entries for the same date together?

  2. Will there always be the four rate entries or can it vary?

Mike Askew 131 Veteran Poster Featured Poster

Could use the replace function

fn:replace(string,pattern,replace) Returns a string that is created by replacing the given pattern with the replace argument

ie. replace(YourNodeString, "Buena Villa House", "")

try that for deletion

Mike Askew 131 Veteran Poster Featured Poster

Not entirely sure how to do that myself, obviously its substrings, however your trying to delete strings that could be any length and position, not sure how you pin it down in terms of XSLT.

Mike Askew 131 Veteran Poster Featured Poster

So what actually remains to be done? As you've solved some of your own problems fine :)

You dont need to change anything about the element re-ordering XSL thats how I would of done it.

Mike Askew 131 Veteran Poster Featured Poster

Semi-double post question, see here

Mike Askew 131 Veteran Poster Featured Poster

@nmaillet, It was probably intended as a code snippet, even then it is very trivial to most of the forums, the only completely non basic functionality is the date format masking and that doesnt take much.

Of course its worth remembering Console.WriteLine(DateTime.Now.ToShortDateString()); Does exactly the same thing as this, but without the need for typing the mask, which instead automatically changes according to the culture settings of the machine (en-US (M/d/yyyy), de-DE (dd.MM.yyyy) etc etc).

The MSDN for this

Mike Askew 131 Veteran Poster Featured Poster

Worth noting also a simplified version of this, written by Dimitre Novatchev of StackOverflow.

I did edit in the attribute writing and correct a element name mapping issue.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:param name="pDoc2" />

  <xsl:variable name="vDoc2" select="document('')/*/xsl:param"/>

  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="header/*[@agg='sum']">
    <xsl:element name="{name(.)}">
      <xsl:attribute name ="agg">sum</xsl:attribute>
      <xsl:value-of select=
    ". + $vDoc2/*/header/*[name()=name(current()) and @agg='sum']"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>
Mike Askew 131 Veteran Poster Featured Poster

Linked to and responded here

Mike Askew 131 Veteran Poster Featured Poster
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:output indent="yes" method="xml"/>
  <xsl:strip-space elements ="*"/>

  <xsl:template match="/">
    <Address>
      <xsl:apply-templates/>
    </Address>
  </xsl:template>

  <xsl:template match="row">
    <xsl:element name="Rowinfo">

      <xsl:element name="Locator">
        <xsl:value-of select="RateNumber"/>
      </xsl:element>

      <xsl:element name="LocatorDesignator">
        <xsl:value-of select ="concat(RateLetter, concat(', ',RateAccomDesc))"/>
      </xsl:element>

      <xsl:element name="thoroughfare">
        <xsl:value-of select="AssessmentStreet"/>
      </xsl:element>

      <xsl:element name="AddressArea">
        <xsl:value-of select="AssessmentStreet"/>
      </xsl:element>

      <xsl:element name="LocatorName">
        <xsl:value-of select="RateAccomDesc"/>
      </xsl:element>

    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

Redid the style sheet slightly, this way allows access to all data within each row when the template is called, else we would need to store the row data in a variable each time.

Feel free to remove the second concatenation as you see fit, the comma seemed to be right considering the output.

With this stylesheet and the above input I get:

<?xml version="1.0" encoding="utf-8"?>
<Address>
  <Rowinfo>
    <Locator>1</Locator>
    <LocatorDesignator>Null, Dwelling (Part Of)</LocatorDesignator>
    <thoroughfare>Abesinia Passage</thoroughfare>
    <AddressArea>Abesinia Passage</AddressArea>
    <LocatorName>Dwelling (Part Of)</LocatorName>
  </Rowinfo>
  <Rowinfo>
    <Locator>1a</Locator>
    <LocatorDesignator>Null, Edmund's Home</LocatorDesignator>
    <thoroughfare>Arena's Palace Lane</thoroughfare>
    <AddressArea>Arena's Palace Lane</AddressArea>
    <LocatorName>Edmund's Home</LocatorName>
  </Rowinfo>
</Address>
abbelylee commented: Perfectly Solved +0
Mike Askew 131 Veteran Poster Featured Poster

Noticed I completely ignored replicating attributes, new XSLT:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output indent ="yes" method="xml"/>
  <xsl:strip-space elements ="*"/>

  <xsl:param name="InputFileTwo">C:\Users\maskew\Documents\DaniWeb\TestXMLTwo.xml</xsl:param>

  <xsl:template match="/">
    <xsl:call-template name="ConcatFiles"/>
  </xsl:template>

  <xsl:template name="ConcatFiles">
    <xsl:variable name="tempStoreDocTwo" select ="document($InputFileTwo)/rootNode/header" />

    <xsl:element name="rootNode">
      <xsl:element name="header">

        <xsl:for-each select="rootNode/header/*">
          <xsl:variable name="pos" select="position()" />
          <xsl:choose>

            <xsl:when test="./@agg = 'sum'">
              <xsl:variable name="tempElementDocTwo" select ="$tempStoreDocTwo/*[$pos]"/>
              <xsl:element name="{name(.)}">
                <xsl:attribute name ="agg">sum</xsl:attribute>
                <xsl:value-of select=". + $tempElementDocTwo"/>
              </xsl:element>

            </xsl:when>

            <xsl:otherwise>
              <xsl:element name="{name(.)}">
                <xsl:attribute name="agg">
                  <xsl:value-of select="./@agg"/>
                </xsl:attribute>
                <xsl:value-of select="."/>
              </xsl:element>

            </xsl:otherwise>

          </xsl:choose>
        </xsl:for-each>

      </xsl:element>
    </xsl:element>

  </xsl:template>

</xsl:stylesheet>
Mike Askew 131 Veteran Poster Featured Poster

Any error messages? What doesn't work.

Please don't just give us a code chunk.

Mike Askew 131 Veteran Poster Featured Poster

Browse DaniWeb excessively often, play League of Legends/Smite, go to the gym, watch tv, wash the car or play with the cat :)

Note first entry on list, my continuous availability monday -> friday 9-5. spot the correlation

Mike Askew 131 Veteran Poster Featured Poster

Sorry, easy fix, replace the current bottom if statement with:

                    if (countNum != skipNum)
                    {
                        // Use static Path methods to extract only the file name from the path.
                        fileName = System.IO.Path.GetFileName(s);
                        destFile = System.IO.Path.Combine(targetPath, fileName);
                        System.IO.File.Copy(s, destFile, true);
                        skipNextFiles = true;
                    }
Mike Askew 131 Veteran Poster Featured Poster

Code is tweaked and tested. With a skipNum of 2, I got files copied: 1, 2, 5, 6, 9, 10 of 10 files.

static void Main(string[] args)
        {
            string fileName;
            string destFile;
            string sourcePath = @"C:\Users\maskew\Documents\DaniWeb\Source";
            string targetPath = @"C:\Users\maskew\Documents\DaniWeb\Destination";
            // To copy all the files in one directory to another directory.
            string[] files = System.IO.Directory.GetFiles(sourcePath);
            // Copy the files and overwrite destination files if they already exist.
            bool skipNextFiles = false;
            int skipNum = 2; //as per the example, set this however you like.
            int countNum = 0; //used to track how many files copied since last skipped file.
            foreach (string s in files)
            {
                if (skipNextFiles)
                {
                    if (countNum != skipNum)
                    {
                        countNum++;
                        if (countNum == skipNum)
                        {
                            countNum = 0;
                            skipNextFiles = false;
                        }
                    }
                }
                else
                {
                    if (countNum != skipNum)
                    {
                        // Use static Path methods to extract only the file name from the path.
                        fileName = System.IO.Path.GetFileName(s);
                        destFile = System.IO.Path.Combine(targetPath, fileName);
                        System.IO.File.Copy(s, destFile, true);
                        countNum++;
                        if (countNum == skipNum)
                        {
                            countNum = 0;
                            skipNextFiles = true;
                        }
                    }
                }
            }
        }
Mike Askew 131 Veteran Poster Featured Poster

Ah shoot sorry missed that when reading the reqs, gimme a min, going to put this into visual studio and fix it.

Mike Askew 131 Veteran Poster Featured Poster
Random Rnd = new Random()
Rnd.Next(); //Generates a random non-negative number
Rnd.Next(1000); //Generates a random non-negative number less than specified number
Rnd.Next(100, 1000); //Generates a random number between the specified range

See here for more on the Random class: http://msdn.microsoft.com/en-us/library/system.random.aspx

In your case you will be using Rnd.Next(MinNumber, MaxNumber);

Mike Askew 131 Veteran Poster Featured Poster

When I first learnt C# I used HomeAndLearn alot as they have quite an extensive c# guide. It will get you going the right way hopefully :)

Mike Askew 131 Veteran Poster Featured Poster

You simply pass the stylesheet the second file location as the parameter InputFileTwo and it will work when run on the primary file, it doesnt matter which way round you do it, however the XSLT will look at the attributes of the primary file to determine concatenation (nothing said otherwise in the requirements).

XSLT Stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                version="1.0">

  <xsl:output indent ="yes" method="xml"/>
  <xsl:strip-space elements ="*"/>

  <xsl:param name="InputFileTwo">C:\Users\maskew\Documents\DaniWeb\TestXMLTwo.xml</xsl:param>

  <xsl:template match="/">
    <xsl:call-template name="ConcatFiles"/>
  </xsl:template>

  <xsl:template name="ConcatFiles">
    <xsl:variable name="tempStoreDocTwo" select ="document($InputFileTwo)/rootNode/header" />

    <xsl:element name="rootNode">
      <xsl:element name="header">

        <xsl:for-each select="rootNode/header/*">
          <xsl:variable name="pos" select="position()" />
          <xsl:choose>

            <xsl:when test="./@agg = 'sum'">
              <xsl:variable name="tempElementDocTwo" select ="$tempStoreDocTwo/*[$pos]"/>
              <xsl:element name="{name(.)}">
                <xsl:value-of select=". + $tempElementDocTwo"/>
              </xsl:element>
            </xsl:when>

            <xsl:otherwise>
              <xsl:element name="{name(.)}">
                <xsl:value-of select="."/>
              </xsl:element>
            </xsl:otherwise>

          </xsl:choose>
        </xsl:for-each>

      </xsl:element>
    </xsl:element>

  </xsl:template>

</xsl:stylesheet>
Mike Askew 131 Veteran Poster Featured Poster
    static void Main(string[] args)
    {
        string fileName;
        string destFile;
        string sourcePath = @"E:\Source";
        string targetPath = @"E:\Destination";
        // To copy all the files in one directory to another directory.
        string[] files = System.IO.Directory.GetFiles(sourcePath);
        // Copy the files and overwrite destination files if they already exist.
        int skipNum = 1; //as per the example, set this however you like.
        int countNum = 0; //used to track how many files copied since last skipped file.
        foreach (string s in files)
        {
            if (countNum != skipNum)
            {
                // Use static Path methods to extract only the file name from the path.
                fileName = System.IO.Path.GetFileName(s);
                destFile = System.IO.Path.Combine(targetPath, fileName);
                System.IO.File.Copy(s, destFile, true);
                countNum++;
            }
            else
            {
                countNum = 0;
            }
        }
    }

Have written this in the reply without testing but its pretty simple so should work hopefully, lemme know any errors and i'll resolve.

Mike Askew 131 Veteran Poster Featured Poster

No worries, what was the issue in the end :)?

Mike Askew 131 Veteran Poster Featured Poster

Are you getting any errors? If so:

  • what is the error?
  • what line does it occur?

It is quite hard to run code in your head and generate errors that you have no clue about.

Mike Askew 131 Veteran Poster Featured Poster

Sounds like a college assignment.

What have you done so far?

Mike Askew 131 Veteran Poster Featured Poster

Change the value in the dataset it is bound too, and then update the datagrid.

Mike Askew 131 Veteran Poster Featured Poster

It will be worth reading: Link and Link. Personally I'm not sure how it's done but Google is a wonderful tool.

Mike Askew 131 Veteran Poster Featured Poster

Useful to know :)

Mike Askew 131 Veteran Poster Featured Poster

Does this 'editbutton' load the second form, or is it already open?

Mike Askew 131 Veteran Poster Featured Poster

Thanks but I won't claim to have written all the code, simple edited stuff I found on the MSDN forums.

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/f2ab109a-36f2-4e41-a9f4-9aa3d5db643f/

Just had to write the loop in the main, and edit the format check to the OP's requirements.

Mike Askew 131 Veteran Poster Featured Poster

Datagrid paging: http://www.codeproject.com/Articles/16303/DataGrid-Paging-C-Windows-Forms

What exactly is the issue with the progress bar? Does it update? Or does it stay blank and update at the end? Please clarify

Mike Askew 131 Veteran Poster Featured Poster
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Globalization;

namespace DaniWebConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ValidDate = false;
            while (!ValidDate)
            {
                Console.Write("Please enter date in format DD/MM/YYYY: ");
                string DateInput = Console.ReadLine();
                ValidDate = ValidateDate(DateInput);
            }
        }

        public static bool ValidateDate(string Date)
        {
            try
            {
                DateTime.ParseExact(Date, "dd/MM/yyyy", DateTimeFormatInfo.InvariantInfo);
                Console.WriteLine("Date Valid.");
            }
            catch
            {
                Console.WriteLine("Date Invalid.");
                return false;
            }
            return true;
        }
    }
}

Basic console app, you input a date and if its invalid it simply requests it again until it is valid.

Mike Askew 131 Veteran Poster Featured Poster

Thank you both, learn something new everyday :)

Mike Askew 131 Veteran Poster Featured Poster

The main question is are you going to mask the input to force that format, or simply tell them to do it and then validate it?

Masking is alot harder.

Mike Askew 131 Veteran Poster Featured Poster

Say I have the below example, the syntax is based off constuctor chaining for clarity (and my cluelessness).

    public static void Feed() : this("Unknown"){}

    public static void Feed(string FoodType)
    {
        if (Food != "Unknown")
            Console.WriteLine("{0} eats some {1}.", Name, Food);
    }

How would I actually implement this for methods? It is of the same style as constructor chaining, that if nothing is passed to the Feed method it will pass Unknown to the latter Feed method.

Such a simple question but its bugging me lol.

Mike Askew 131 Veteran Poster Featured Poster

Might be worth moving this to mobile development as it seems more related.

Mike Askew 131 Veteran Poster Featured Poster

What you actually mean: Is a property faster than a method.

In the provided code it wont really matter as your doing such miniscule operations it is probably hard to split the difference in performance. Plus I doubt there is one as both are very simple operations.

    public string GetString()
    {
        string value = stringValue;
        return value;
    }

Would be the correct code for the method, your using an out for no real reason :)

Mike Askew 131 Veteran Poster Featured Poster

Wish granted; You fly into a jet engine.

I wish I could control the flow of time.

Mike Askew 131 Veteran Poster Featured Poster

If you give me the input xml, and the wanted output xml, highlighting what changes; that can be done.

Mike Askew 131 Veteran Poster Featured Poster

What language? As this is more an issue for that specific forum than an XML one.