Why would you want to return a list, if you only need one item?
string mm = listContracts.Count > 0
? listContracts[0].M
: string.Empty;
Anyways, if you want to make the whole list of M-properties first, don't forget to initialize listM (you cannot add items to a null-reference)...
O, I forgot to mention this:
[code]
public IEnumerable<Person> AllPersonsInClass
{
foreach(Person p in _studens)
{
yield return p;
}
foreach(Person p in _teachers)
{
yield return p;
}
yield return _janitor;
}
The code in your example has no advantage - you could just return the collection, or the enumerator of the collection.
However, as soon as want to do something with the items in the collection before returning them, you either have to build an enumerator-class, or use the construction with the...
No, the yield-statement helps you to implement IEnumerable, without having to build Enumerator-classes.
You can use it if you need read-only collection-like functionality - only enable foreach.
However, if you combine with Linq, there are lots of extra possiblities for the consumer.
example...
<xsl:when test="node[text()='a']">
<xsl:when test="node = 'a'">
<xsl:when test="node[. ='a']">
all match <context><node>a</node></context>
However, only
<xsl:when test="node[text()='a']">
matches
<context><node>a<othernode>b</othernode></node></context>
In general, it is not advised to have a...
Interesting interview.
However: mr. H. is not arguing that 'one should have 10 try/catch blocks per throw' as you stated in your first post. Actually the interview is about why C# does not have 'checked exceptions'. Mr H. reasons that having checked exceptions 'requires you to either catch...
'@name' means an atrribte, as in:
<person name="jack" />
'/name' means a child-node, as in:
<person>
<name>jack</name>
</person>
Good to hear it works, congrats.
Ow,
First recheck your XML: it is not valid.
if you meant something like
<doc>
<new id="22234" name="Bob">
<more id="22234" address="somewhere" />
<more id="22234" address="somewhere else" />
</new>
<new id="22235" name="George">
<more id="22235" address="somewhere new" />
</new>...
Sorry, I don't know about Sharepoint.
It seems to me that CALLS are the equivalent of Rows, and HelpCall to Row.
Whether or not you have to include dsqueryresponse I can't say, as I don't know the Sharepoint output.
However, you can find out a lot by by using '//nodename' (meaning any node named...
Tsuji,
You're quite right.
All in all, I think the best way to handle dates in this case would be just to add them in the XML on creation: a transformation should contain as little calculations and logic as possible.
I love the way you calculate the max-values: more elegant and efficient then...
And just because my pc stands in the only room where I'm allowed to smoke, here's one that also calculates the current month as the last month in the xml.
Notice that it is no real calculation, it's more like string-manupulation.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"...
Doing calculations on dates is not really funny in XSLT: for example: there is no function that gives you the current date. In this example I just use fixed string-values.
Counting is not to difficult.
I had to correct your xml to make this example:
<CALLS>
<HelpCall>
<ID>1</ID>...
My guess would be:
there already exists an overload Object.Equals(Object, Object), and that one is indeed a static - it cannot be accessed with an instance reference.
As DateTime and emums all are objects, your method has the same signature as the existing one.
Have you tried changing the name...
As you declare and assign the variable in a for-each, you re-assign it multiple times. It is rather inpredictable what the value is going to be.
Apart from that, the variable is 'out of scope' outside the <xsl:if ...>.
The scope-problem can be solved like this:
<xsl:variable name="myvar">...
Using Crystal as included in VS2003, I want to make a simple graph showing the number of people participating in different groups.
I made a dataset with one table, columns: date, number, groupname.
I inserted a Chart, and using the Chart-expert on the Data-tab selected 'on change of': date...
In a scripting or programming-language you could use MSxml.DomDocument to copy nodes.
Using XSL you could use the document() function to access another xml-file.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.