Browsing 7239 questions and answers with Jon Skeet
Well it's not quite as you were asking for, but this does replace an element with a commented version: using System; using System.Xml.Linq; public class Test { static void Main() { var doc = new XDocument( ... more 12/15/2014 8:48:28 AM
You need to use the Attribute method to get at an attribute. You'll need to query for Phone elements with a Type attribute of Home. For example: Console.WriteLine("Home: {0}", employee.Elements("Phone") .Single(x =>... more 12/15/2014 8:09:57 AM
Firstly - these are lists, they're not arrays. If they were arrays, they would be things like string[] and int[]. However, you definitely shouldn't have all these separate lists. Instead, work out what the relevant types are - it's not... more 12/14/2014 5:39:18 PM
If you want the equivalent of c.uuid = newUuidValue; but with reflection, you just want: uuidField.set(c, newUuidValue); The first argument to set is a reference to the object whose field you want to modify. more 12/13/2014 11:17:24 PM
When you're casting from Object, you're unboxing from the wrapper type... and you can only unbox to the original type, basically. It's effectively a cast to the relevant wrapper type, followed by a call to the appropriate xxxValue method.... more 12/13/2014 2:30:04 PM
There's only one connection there - and a command using the same connection. Both will be disposed. This is effectively: using(OleDbConnection con = new OleDbConnection(conString)) { using(OleDbCommand command = con.CreateCommand()) ... more 12/13/2014 2:27:11 PM
I'd first advise you to take note of the fact that you're referring to these objects as accounts - that suggests you should quite possibly have an Account type, which contains the List<String> of messages. Aside from anything else,... more 12/12/2014 8:01:24 PM
The Computer part in your assignment is invalid - you're trying to declare anything. It should just be: c[0] = new Computer(...); At that point it will compile - but you'll get a NullPointerException when i is 1. You'll need to either... more 12/12/2014 6:34:53 PM
The "12-7 = 5" is definitely related to the problem... or more accurately, it's "12-5=7", i.e. 5 hours before midnight is 7pm. You'll see that if you format it as a full date/time: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd... more 12/12/2014 3:28:37 PM
The simplest way of doing this would be just to use a MemoryStream Encrypt to the MemoryStream Close the writer at the end, to make sure everything's flushed Call MemoryStream.ToArray to get the encrypted data Write the encrypted data to... more 12/12/2014 3:03:31 PM