Browsing 7239 questions and answers with Jon Skeet

"The multi part identifier could not be bound" sql, visual studio

I am just learning c# and sql server. This question has been asked a couple of times but the solutions posted don't seem to help me. I have a table called "LoginInfo" that has a...
Jon Skeet
people
quotationmark

The clue is in the error message: The multi-part identifier "XXXX.edu" could not be bound. That strongly suggests that the problem isn't with identifying your table - it's with the bit that ends with "edu", which seems like to be an... more 5/23/2016 6:32:39 AM

people

FileNotFound Exception with

I have the following code; String files=""; for (int i=0; i<filelist.size()-1;i++) { files=files+filelist.get(i).getPath()+",...
Jon Skeet
people
quotationmark

You're starting the process, but you're trying to use the file before it's had much of a chance to get going. I suspect you need to wait for it to finish: zipping.WaitForExit(); more 5/22/2016 7:54:40 PM

people

Set all array values to 0 with Lambda/linq

Is it possible to set all int array values to 0 with Lambda/Linq? public int[] Reset() { int[] M = new int[MIlg]; \\MIlg - length of array for (int i = 0; i <...
Jon Skeet
people
quotationmark

LINQ is inherently about querying, not modifying. But there's already a method that does this - Array.Clear: Array.Clear(array, 0, array.Length); That's assuming you want to clear an existing array, of course. Your current method... more 5/22/2016 7:37:44 AM

people

How does setting a value to null let us avoid loitering and enable garbage collection?

I'm looking at a method (delMin()) for deleting the small element in a heap. It sets the variable min to equal the min value and then sets the value of min to null to "avoid...
Jon Skeet
people
quotationmark

and then sets the value of min to null No it doesn't. It sets the final used element of the array to null, so that the array no longer holds a reference to that object. An object can only be garbage collected when there are no more... more 5/22/2016 7:25:08 AM

people

Why is it impossible to use generic type for variable when instantiating object with concrete type?

class A{} class B extends A {} class C extends B {} class D<C> { C c = new A(); // COMPILER ERROR } After type erasure code becomes: class D { Object c = new...
Jon Skeet
people
quotationmark

So, what's the problem here? The first problem is that within D<C>, C refers to the type parameter called, C, not the class C that extends B. Next, even ignoring generics, C c = new A(); // Invalid ... wouldn't compile...... more 5/21/2016 1:47:50 PM

people

Compare each and every items of two arrays C#

I do have two arrays: int[] oddArr = { 11, 9, ... }; int[] evenArr = {4, 2, 8, ... }; I want to check if every items from oddArr is greater than every items from evenArr then...
Jon Skeet
people
quotationmark

I would think about the problem differently - for everything in oddArr to be greater than everything in evenArr, then the minimum of oddArr has to be greater than the maximum of evenArr: if (oddArr.Min() > evenArr.Max()) (You'll need... more 5/21/2016 7:49:38 AM

people

Decompiling leads to error CS1112, assembly confusion

So I ran a C# university program through de4dot and then reflector to decompile it and the following error appeared when I ran it in VS. [assembly:...
Jon Skeet
people
quotationmark

You're meant to add the this modifier to the method: public static class FooExtensions { public static void DoSomething(this Foo foo) { ... } } That makes it an extension method. In general thought, I wouldn't try... more 5/21/2016 7:48:16 AM

people

java streams How to filter a collection to two new collections

I tried to create two lists - odds and evens as follows: public static void main(String[] args) { List<Integer> numbers = new ArrayList<>(Arrays.asList(1, 2, 3,...
Jon Skeet
people
quotationmark

Well, you can make your existing code compile with a trivial modification: public static void main(String[] args) { List<Integer> numbers = new ArrayList<>(Arrays.asList(1, 2, 3, 5, 8, 13, 21)); ... more 5/20/2016 3:41:22 PM

people

C# "No way to resolve conflict between X and Y"

I have the following solution structure: Solution \_ProjectA \_ProjectB (uses 3rd party DLL v1) \_ProjectC (uses 3rd party DLL v2) Project A has no direct...
Jon Skeet
people
quotationmark

How do I force those projects to use those specific versions? You can't, basically. Certainly not even close to easily. Even though Project A doesn't directly use the 3rd party DLLs, the CLR will still have to load them... at which... more 5/20/2016 11:43:03 AM

people

Value of previous variable becomes value of current variable

I got a problem with my code. As I try to compare two variables with different values by calling isEqual() method. But it gave me a result of true. Can someone spot the...
Jon Skeet
people
quotationmark

As I try to compare two variables with different values by calling isEqual() method. You don't have variables with different values, because you only have one value - a static variable: private static double precision; (Change the... more 5/20/2016 6:17:14 AM

people