Browsing 7239 questions and answers with Jon Skeet
So why would we need BufferedStream if we can set buffer size in FileStream itself. Because not every stream is a FileStream. What about NetworkStream? Or some other arbitrary stream? Or a situation where the code that needs buffering... more 10/18/2013 12:12:18 PM
I suspect you want: private List<string> GetModules() { return XDocument.Load(Server.MapPath(@"~\App_Data\UGNX.xml") .Root // Root element .Elements("modul") // Select child... more 10/18/2013 10:59:26 AM
I can't say I've used EF myself, but in general LINQ doesn't mutate queries when you call a method - instead it returns a new query. So if you change your code to: DbQuery<T> entities = db.Set<T>(); foreach (var... more 10/18/2013 10:05:13 AM
You can use the \U escape sequence: string text = "Ace of hearts: \U0001f0b1"; Of course, you'll have to be using a font which supports that character... As an aside, I'd strongly recommend avoiding the \x escape sequence, as they're... more 10/18/2013 8:49:34 AM
You can simplify it slightly by calling PropertyInfo.GetValue instead: SelectedValue = (IFace)SelectedType .GetProperty("Instance", BindingFlags.Static | BindingFlags.Public) .GetValue(null, null); As of .NET 4.5 you could call... more 10/18/2013 8:30:47 AM
(I'm assuming you're talking about Java or .NET.) will that not result in a massive memory leak if my application makes allot of changes to the text box No. It may require many strings to be created, but they can then be garbage... more 10/18/2013 6:37:03 AM
Obviously code like this should never actually occur. It's horrendous. I don't think you should spend too much time worrying about why it gives 7, but it's actually not too hard to see why. The first field value to be evaluated is... more 10/18/2013 6:22:12 AM
Top-level types default to being internal, but nested types default to being private. You've therefore got an internal type with a public method that has a private type as a parameter. Making all the access modifiers explicit: internal... more 10/18/2013 5:52:27 AM
One simple option would be to use a Stopwatch. Start it when you start the timer, and call Restart at the start of each tick handler - indeed, you can do this separately by adding a handler just to do the stopwatch restart before you add... more 10/17/2013 10:33:36 PM
This is the problem: MissionTemplate[] MISSION = new MissionTemplate[gen]; for (int i = 1; i <= gen; i++) { ... MISSION[i] = new MissionTemplate(); Aside from violating normal naming conventions, arrays in C# are 0-based -... more 10/17/2013 9:11:08 PM