What is the best way to return the whole number part of a decimal (in c#)? (This has to work for very large numbers that may not fit into an int).
GetIntPart(343564564.4342) >> 343564564
GetIntPart(-323489.32) >> -323489
GetIntPart(324) >> 324
The purpose of this is: I am inserting into a decimal (30,4) field in the db, and want to e...
People use frequently something like:
<ListBox ItemsSource="{Binding ElementName=thisControl, Path=ListIndexes}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Content="{Binding Path=IndexName}"/>
<Label Content="{Binding Path=IndexValue}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
But I would like ...
Hi Guys,
Quick question (I hope), how do I include a window 6 class library dll in a standard net project? I seem to be able to just add a reference via VS in earlier editions of windows mobile projects, but not with version 6. From what I read it should be possible as long as not CE specific libraries have been used.
Any help appreci...
It's well known that you cannot set foreign key IDs directly in Linq to SQL if the entities have already been loaded. You can however look up the entity by it's foreign key and then set the entity as the foreign entity using the entity relationship. (I've taken out the enum here and used integer values for simplicity). i.e. If I have a...
What is the nicest way of replacing the host-part of an Uri using .NET?
I.e.:
string ReplaceHost(string original, string newHostName);
//...
string s = ReplaceHost("http://oldhostname/index.html", "newhostname");
Assert.AreEqual("http://newhostname/index.html", s);
//...
string s = ReplaceHost("http://user:pass@oldhostname/index.html",...
Is there a way to find out the z-order of all active windows in my application (application.current.windows)
or any other way to find out what is the "parent" window of a modal window?
I am trying to implement a "shader" functionality, that should fade the parent window when a modal window is shown. (the only way I have found so far i...
I have three Tables
Customers, Jobs, Orders
I Also have these tables in the a DataSet, which conforms to the same constraints as those in the Database itself.
Originally, my intention was to keep the Data in the DataSet, and create various DataView objects to display this data to the user, and also to perform any required manipulations...
Title says it all, how good is C# type inference? I read somewhere that it's only for local variables? Does it work for class level attributes? For method signatures? Method return types? etc.
...
I'm possibly just blind, but is there a command line to specify conditional compilation symbols in MSBUILD?
I currently have this Line in my buildscript:
SET MSBUILD=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
SET CONFIG=Debug
%MSBUILD% /p:Configuration=%CONFIG% /p:OutputPath=..\..\output source\MyProject\MyProject.csproj...
Is it somehow possible to customize or subclass System.Windows.Forms.ColorDialog to add a few buttons? I know that it uses the native Windows color dialog, but is there a way to customize it from .NET?
...
The title pretty much says it all. When I'm doing some reflection through my classes, will the MemberInfo.GetCustomAttributes() method preserve the order of attributes on a member, or not? The official documentation does not say anything one way or the other.
In case you're wondering why I would need this, here's the full explanation....
Lets assume that I'm dealing with a service that involves sending large amounts of data.
If I implement this with WCF, will WCF throttle the service based on how much memory each request takes to serve? Or will I be getting continuous out of memory exceptions each time I receive a large number of hits to my service?
I'm quite curious a...
I have two List's which I want to check for corresponding numbers.
for example
List<int> a = new List<int>(){1, 2, 3, 4, 5};
List<int> b = new List<int>() {0, 4, 8, 12};
Should give the result 4.
Is there an easy way to do this without too much looping through the lists?
I'm on 3.0 for the project where I need this so no Linq.
...
Java has a regex function called "LookingAt()" which will allow partial matches against patterns, my question is:
Does .net have an equivalent of "LookingAt()"?
I may or may not use it for KeyPress validation but I just would like to know for future reference.
Thanks in advance
Jon
...
Is there any way to set a property that is not generated by Linq to SQL designer (is not a column in database) in a query?
For example is there such a method like SomeMethod():
IQuaryable<T> query = (from t in context.MyTable
where {some conditions}
select t).SomeMethod("MyPropertyName", valu...
How do I tell is a Drag Drop has ended WinForms .net. I need to stop part of my form from refreshing it's view of data when a drag drop is in progress.
I have tried using a flag but I don't seem to be capturing all the events I need to to keep the flag in sync with the progress of drag drop. Specifically I can't tell when the drag dro...
When you load an UserControl in the WinForm designer, VisualStudio executes the InitializeComponent() method of the control, but not its constructor.
This really makes a difference because it's quite common to have some code in the constructor which cannot run at design time.
Unfortunately, when you add an UserControl to another control...
I tend to make the length of character strings some power of two (16, 32, 64). Is there any optimaztion benefit in doing this for objects of type string such as a string variable, a collection of strings, or a column in a database of type string? This is in a .net/sql server environment.
...
The .Net C# offers two (well four) constructors:
Regex(String)
Regex(String,RegexOptions)
The first constructs a regular expression with default options, while the second gives you somewhat more control. Take a peak under the hood with Reflector shows that the first constructor calls the second with a RegexOptions.None as second para...
We have a multilingual site that utilizes asp.net 2.0 cultures. The current culture is set through the url rewritten as a query string. (~/es/blah.aspx is the spanish version of ~/blah.aspx - rewritten as ~/blah.aspx?lang=es)
The code that tests the culture is as follows:
System.Globalization.CultureInfo ci;
try
{
...