|
A Row may be a record, but a (logical) Record may comprise several Rows across several tables. It's like atoms (rows) and molecules (records).
So, DataTables use DataRows, excellent.
System.Data.DataRow
System.Data.DataRowView
System.Data.DataTable.Rows
System.Data.DataTable.NewRow
System.Data.DataView.RowFilter
But why, then, is a System.Data.IDataReader a System.Data.IDataRecord ? Which is illogical. Why not System.Data.IDataRow ?
|
|
|
|
|
It has been a long time since I've touched that corner of .NET but I seem to remember that the IDataRow exists somewhere and has things like events on it or otherwise at least things that IDataRecord can't do, and maybe, if memory serves, IDataRecord accesses things closer to the metal (using raw DB types and such) than IDataRow.
To err is human. Fortune favors the monsters.
|
|
|
|
|
imho such "genomic duplication" reflects the bumpy evolution of so-called "computer languages," as language implementers seek to broaden usage by incorporating familiar semantics ... at the cost of semantic consistency.
imho, "Where" in Linq is a good example: what it actually does is select; while Linq "Select" really means transform. But, those semantic choices were consistent with what SQL users were familiar with.
If you disagree, please enlighten me: I never had any depth experience with SQL.
cheers, Bill
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Don't ask MS "why you give this name?" MS always fail here (like naming responsibility were given to mexican hobo). Add here that .NET itself is a "renamed Java" with appropriate legacy. And only years later MS made .NET "as it should be", but legacy classes still here. That's why we have Array completely incompatible with simple List<>. Don't ask, just ignore.
|
|
|
|
|
This could have been answer without naming any nationality.
|
|
|
|
|
Why not? Or you SCARED to say anything w/o government approval? Sorry, but I don't play this "tolerant games".
|
|
|
|
|
I'm lucky to live in a country where I can say pretty much what I want without the government coming after me. I'm also lucky enough to be in a position where I don't need to diminish anyone to feel that I'm better.
|
|
|
|
|
Very right now you try to diminish me to feel higher than me. Because by some reason you think I offended somebody. Elaborate HOW, please??
|
|
|
|
|
Nobody needs to try to diminish you. Your ability to write in English (or, really, the lack thereof) does that quite happily, all by itself.
|
|
|
|
|
Your reply is just proof you're dumb young sh.... who tries to diminish people just to feel better (because in reality you're nothing).
English is my SECONDARY language and as a secondary it's more than good. But main point is you're so miserable that knowing nothing about me all you could say is "your english is bad". Yep, I know! When pathetic people try to offend me, they use my English level. Enough said, dumb! You're not interesting anymore, get lost.
|
|
|
|
|
Oh well.
Thanks for calling me young, though. At 56, having been programming for 43 years, I find it quite invigorating when idiots make assumptions. But at least you've got proof.
|
|
|
|
|
Well you've potentially offended hobos, Mexican's, and Mexican hobos.
As a hobo myself I am very offended.
|
|
|
|
|
As a monkey who permanently offended on everything, you need some help - suck smth for example.
|
|
|
|
|
|
You really need some mental gymnastic to read my message and think that I'm trying to diminish you.
I am not the one inserting some nationality (Mexican in your case) followed by a derogatory term (hobo) to say something is bad.
I was not offended, I just said that the message could have been answered without inserting any nationality. I don't get offended by random people on Internet, I would be a very bitter person if I did. But I also tend to think that bigots are usually not the smartest people in the planet.
That being said, I'm not interested in wasting more time responding to someone that is showing your kind of behaviour, I have better things to do with my life.
Hasta la vista Thornik.
|
|
|
|
|
DataRows are related to the tabular nature of a DataGridView and don't have to be backed by a database. DataRecords are related to actual database records.
|
|
|
|
|
obermd wrote: DataRecords are related to actual database records.
Not necessarily.
|
|
|
|
|
A DataReader is "forward reading" only. "Rows" have never been part of the nomenclature associated with sequential data sets (i.e. records; record set).
Rows can be usually be [indexed]; "records" rarely, unless they're fixed length (it's usually a positioning; then a read).
DataReader.HasRows throws it all out the window; of course.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
OK, so after my earlier post, I found that I was compiling with C# 6 turned on without realizing it.
I prefer to use new features of C# only if they offer me something useful. I use only a few features of C# 3, and no newer features than that, so I want my code to compile with C# 3 selected, but I hadn't been bothering to specify it, I had left it set to the default (my fault of course).
So yesterday I spent some time ensuring that my libraries and utilities will compile with C# 3.
And BOOM! one of my recent utilities complained:
error CS0840: '[REDACTED].CommonBase.ScriptXML.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.
and
error CS8026: Feature 'readonly automatically implemented properties' is not available in C# 3. Please use language version 6 or greater.
(Messages from two versions of CSC.EXE . I'm not sure which is the more helpful.)
It turns out that a few months back, I had made a copy/paste error. I had intended to write:
public System.Xml.XmlNode ScriptXML { get ; private set ; }
but, because I had copied:
System.Xml.XmlNode ScriptXML { get ; }
from an Interface definition, I wound up with:
public System.Xml.XmlNode ScriptXML { get ; }
I had forgotten to add the private set ; (or do I want it protected?) and the compiler (set to C# 6) was fine with it! !
Yeah, OK, so it's not actually a bug, but it's a coding error and I wish I had been alerted to it when I first wrote it.
Going forward, I am specifying /langversion:3 until I find a useful feature of some future version.
Bonus: My work laptop has these two versions of CSC.EXE:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe Supports up to C# 5
C:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe Supports up to C# 6
and, of course, I had been using the newer version (as you do). I expect the newer version was installed in the past month.
But I found that utilities compiled with the newer version won't run on the servers, so I had to revert to using the older version when I compile on the command line, which is the norm for my utilities.
Yes, I do use Visual Studio (2015) on occasion, but not for making release builds of command-line utilities to deploy to the servers.
|
|
|
|
|
PIEBALDconsult wrote: it's a coding error
That depends on your intention.
If you wanted a property which could be modified by any code within your class, then yes.
If you wanted a true "read-only" property, which can only be initialized in the constructor or an initializer, then omitting the private set; is perfectly correct.
public class Foo
{
public int Bar { get; private set; }
public int Baz { get; }
public Foo(int bar, int baz)
{
Bar = bar;
Baz = baz;
}
public void Groot()
{
Bar = 42;
Baz = 42;
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: could be modified by any code within your class
Yes. Even though I don't intend to change it. I prefer to leave that option open, possibly even making it protected instead.
Richard Deeming wrote: can only be initialized in the constructor
No. I prefer not to tie my hands that tightly. And I didn't realize that was the implication. I do occasionally make a readonly field though.
That "feature" may be good, but the implementation is not -- adding a limitation by not writing something.
|
|
|
|
|
That "feature" may be good, but the implementation is not -- adding a limitation by not writing something.
Say what? You are not "adding a limitation". You are not adding a feature (by not writing something). Or, written in the positive, You need to write something to add the capability. That's perfectly natural and correct.
Truth,
James
modified 1-Sep-22 9:08am.
|
|
|
|
|
I was just sure this was going to be about how sometime readonly isn't really readonly.
|
|
|
|
|
Command line utilities should be written in notepad and compiled with csc.exe.
|
|
|
|
|
Yes, which is what I do... as far as you know . (I actually wrote my own simple IDE.)
I don't like that notepad can't be flexible on TABs. I do use it for XML though.
|
|
|
|