Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The methods on <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Enumeration.html" rel="nofollow"><code>Enumeration&lt;E&gt;</code></a> look like they achieve similar purposes to the <a href="http://msdn.microsoft.com/en-us/library/78dfe2yb.aspx" rel="nofollow"><code>IEnumerator&lt;T&gt;</code></a> interface in C#, but with slightly different semantics. The <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.movenext.aspx" rel="nofollow"><code>MoveNext()</code></a> method, for example, fulfills both purposes: it moves to the next element <em>and</em> returns a boolean to tell you whether there was a next element to move to.</p> <p>But I find it highly unlikely that you really <em>need</em> this interface. Can you share more details about what you're trying to achieve? It's often possible to write much nicer C# code than you'd get doing a straight-across conversion.</p> <h3>Update</h3> <p>Ack! My eyes! Okay, so this is antiquated (or just poorly done) Java code in the first place. Instead of:</p> <pre><code> Enumeration objEnum = null; for (objEnum=objStructureHT.keys(); objEnum.hasMoreElements();){ String strFieldName = (String)objEnum.nextElement(); </code></pre> <p>It should be:</p> <pre><code> for (String strFieldName : objStructureHT.keys()){ </code></pre> <p>Which translates nicely in C# to (assuming you're using a <code>Dictionary&lt;string, string&gt;</code> for <code>objStructureHT</code>:</p> <pre><code> foreach (string strFieldName in objStructureHT.Keys){ </code></pre> <p>However, the only reason you're even getting the <code>Keys</code> is so that you can look up each one and get its value too, right? So there's a better way:</p> <pre><code> foreach (var pair in objStructureHT){ string strFieldName = pair.Key; string strDataType = pair.Value; ... </code></pre> <p>... which makes one wonder why we're even using a <code>Dictionary</code> instead of a class with <code>FieldName</code> and <code>DataType</code> properties. But that's getting beyond the scope of this question.</p> <p>Does this all make sense?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload