.net

Entity Framework 4 DDL

I have been using the model-first approach for about two weeks now and it works great. I also used the "Generate Database from Model" option, which results in a DDL being generated, which in turn is an SQL script that I run to create the database. If I add entities to my model and update the DDL it does not add an alter statement to enti...

i want to produce a pdf from some api in .net, in which i must have an option for text rotation

i need text rotation option in pdf creation, is it somehow possible? does any such api exists? ...

Using a C# regex to parse a domain name?

I need to parse the domain name from a string. The string can vary and I need the exact domain. Examples of Strings: http://somename.de/ www.somename.de/ somename.de/ somename.de/somesubdirectory www.somename.de/?pe=12 I need it in the following format with just the domain name, the tld, and the www, if applicable: www.somename.de...

Problem sending mails with multiple threads

Hi i have a problem with the code below. the mail is sent with a duplicate content of the string s. why is this happening? static void Main(string[] args) { List<String> liste = new List<String>(); liste.Add("1"); liste.Add("2"); liste.Add("3"); liste.Add("4"); liste.Add("5"); ...

When to use Sql Management Objects (SMO)

I'm working on a project that leverages database metadata. To date I've just queried the database catalog views (e.g. sys.tables) but I know this will be "easier" with SMO if I'm willing to add the dependency. What are the advantages to SMO over metadata queries? Any "gotchas" (e.g. needing to have additional SQL libraries on my local ...

Why do event handlers always have a return type of void?

Hey, I wondered why is it that the return type of events such as private void button1_Click(object sender, EventArgs e) always void? can it return any value too? ...

Create Report from list of objects in .net without saving them in database!

I want to create a report of a list of objects that don't persist in db in VS2008 C#! When I use Crystal Report, I should reference the report to a special Table in DB or an object in Application. But I want to report from a non-persistent list which is a list of objects from a class. ...

Using nMoq, how would one expect for a given Event?

Let's say I want to make a Unit-Test where I have this Tetris game and I want to start the game, do nothing, and wait for the game to be over (this is, to get a GameOver event): Tetris tetris = new Tetris(); tetris.GameOver += something; tetris.Start(); How should I make the test? This should probably be easy but I can't see how to do...

How to compare list of X to list of Y in C# by using generics?

I have 2 classes, X and Y. Both classes have same similar property like below. class X { public string T1 { get; set; } public string T2 { get; set; } public string T3 { get; set; } } class Y { public string T1 { get; set; } public string T2 { get; set; } public string T3 { get; set; } public string O1 { ge...

Skype - How to use flash or flex or action script?

Question. How can i get started with flash/flex or actionscript, to use the Skype4Com, and make something small like this site: https://imo.im/ After login with my SkypID, i can make a voice call from browser using Flash? How, can i get started on this, can someone show me a way please. Thank you ...

Where to get specification for keep-alive in sockets in .NET?

Hi, I'm trying to find out how exactly keep-alive works in .NET but link from here doesn't work. Could anybody post a link with specification? What I'm looking for: I would like to know how often are the keep-alive packets sent. Do I have to set KeepAlive via command: s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Ke...

How can I view MSIL / CIL generated by C# compiler? Why is it called assembly?

Hello, I'm new to .NET C# programming. I'm following few books. It is said that instead of compiling it directly to binary code (Native code). High level code is converted into intermediate language (called MSIL aka CIL). But when I compile, I get an exe/Dll file. Is this MSIL/CIL containted in these exe/dll file? I want to see that i...

What's Wrong with an ArrayList?

Recently I asked a question on SO that had mentioned the possible use of an c# ArrayList for a solution. A comment was made that using an arraylist is bad. I would like to more about this. I have never heard this statement before about arraylists. could sombody bring me up to speed on the possible performance problems with using arrayli...

How to turn .h file +dll into some kind of .Net wrapper?

How toturn .h file +dll into some kind of .Net wrapper? or something like that? (no C\C++ sources just h files) ...

.NET Micro framework and unsupported features. What is the impact?

Hi, I found this table listing the limitations of the .NET Micro framework in embedded development, it states that generics are not available due to the size of the image this would create. The memory footprint needs to be below 300KB, and the inclusion of generics pushes the size over this limit. Does this mean that any Micro framewor...

How could I unit test this?

I am using the Mono and Lokad quality libraries to develop an API which does things like inspect the characteristics of methods to see if they throw exceptions, etc etc. One of my methods I have in this API looks like this: // Get all methods which have a NotImplementedException var throwingMethods = _codebase.Methods .Where(m => m...

Is there a way to get text from windows/classes other than Win32 WM_GetText

Is there a .net namespace or similar/simpler way to get text from windows and child classes (controls) other than using a Win32 API messages? I think there is a way to get the handle of the active window in .net without WinAPI. Anyone know what namespace/class does that? ...

Restrict value of a parameter in a constructor AT DESIGN TIME

I'd like to restrict the value of a number parameter in a constructor to within a certain range. I know the conventional way is to do something like the following: public class Foo { public int MaxAmount { get; } public int Amount { get; set; } public Foo(int amount) { if (amount > MaxAmount) { Amount = MaxAmou...

What exceptions should I expect from P/Invoke unsafe code?

Hi skilled, In my solution I've written the following: [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] static extern unsafe bool CopyFileEx(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, Boolean* pbCanc...

Code Analysis tool errors with "The given key was not present in the dictionary."

I get the following unhelpful error while building my .NET project when Code Analysis runs. It happens both in Visual Studio and building from the command line with MSBuild. * 1 total analysis engine exceptions. MSBUILD : error : CA0001 : The given key was not present in the dictionary. Any ideas on what is broken? Edit: Have fo...