myfavoritemovies.us

April 29, 2008

Compiler complains about ‘Linq’

Filed under: Linq — Tags: , , — @ 6:37 am

I developed an application using VS 2008 and build on the box and everything was good. Now we were implementing the code compile in the CI environment. Where I installed .Net framework 3.5.

Now when I try to compile the code in Ci environment I get an error ‘Linq’ is missing. I checked assemblies and found System.Xml.Linq is in the GAC. I even added that as a reference to in the compile task. That didn’t resolve the problem. After some research I found out that, it looks like System.Linq is in System.Core.dll and even though it is in the GAC, we must explicitly include that as a reference during compile. Once I added that as a part of reference, the Linq error went away.

So, be careful on this.

April 24, 2008

Finding string from an array

Filed under: Linq,Tips and Tricks — Tags: , , , — @ 2:26 pm

I ran into a situation where, I need to find a string from a string array where I know only the part of the string I am looking for. So if I would be writing the code in C#2.0 the code would be something like the following;

string[] array = {“help”,”Csharp rocks”,”I am learning”};

string findString = “rocks”;

string matchedString=””;

foreach(string str in array)

{

if (str.Contains(findString))

{

matchedString = str;

break;

}

}

if (matchedString.Length > 0)

{

// the code to handle the logic goes here.

}

(more…)

Powered by WordPress