Let's say I have the following code which update a field of a struct using reflection. Since the struct instance is copied into the DynamicUpdate method, it needs to be boxed to an object before being passed.
struct Person
{
public int id;
}
class Test
{
static void Main()
{
object person = RuntimeHelpers.GetObject...
As the title says, what's the most efficient way to get a random selection of x DataRows from a DataTable.
Would it be to iteratively do something like the following until I have as many as I need?
protected DataRow SelectRandomRow(DataTable dataTable, Random randomSelector)
{
return dataTable.Rows[randomSelector.Next(dataTable.Row...
How can I check if a weirdo character I'd like to use is included in the used font?
...
An answer in this question made me wonder about the .NET framework design choices.
The .NET framework has full support for Partial classes, interfaces, and methods. Is there a compelling reason that support for partial constructors was not added, in the same manner?
This seems like it would simplify class construction within partial c...
I have an MDI Windows Forms application (.net 2008) that allows the user to associate various file types with the application. I currently do this with a registry entry something like this, that causes the application to load and access the file name via the command line:
Registry.SetValue(appKey & "\shell\open\command", "", """" & _
...
I have a web service that looks like this
[WebMethod]
public int Import(System.Collections.Generic.List<Record> importRecords)
{
int count = 0;
if (importRecords != null && importRecords.Count > 1)
{
DataLayer datalayer = new DataLayer();
foreach (Record brec in importRecords)
...
In Winforms (.NET 2.0+), Form has AutoScrollMinSize so you can set the minimum area that the scrollbars help you maintain. What's the equivalent in ToolStripContainer.ContentPanel (ie: ToolStripContainer)? All of the methods I can find (AutoScroll, AutoScrollMargin, AutoScrollMinSize, etc.) say "This property is not relevant for this cla...
Is there any way that we can insert a new control in a panel on previous index as we can do with the List collection like this:
List.Insert(2,Value);
I am working with C# winforms.
I want to do this because I want to access the controls in a specific order, like this:
Control c = panelThumbnail.GetNextControl(control, true);
It gi...
Hi
I am going to develop a Windows application in .net and I will be string few values. (A max of 20 values).
What is the best way of storing this? Using SQLIte seems to be a overkill.
My.Settings seem to forget the values sometimes.
What is the best way of storing these values?
is XML okay?
...
I have a repeating table, and I want one of the fields to be a hyperlink. There doesn't seem to be any way to set the address of the hyperlink based on a formula, though. I want to be able to make the address equal to some base URL concatenated with one of the other fields in the table. Is there any way to do this?
...
I've been using AppDomain.CurrentDomain.ApplicationIdentity.FullName to get the name of the executing application from a DLL that is called by the app but have just discovered that AppDomain.CurrentDomain.ApplicationIdentity can be null resulting in a null reference exception.
Couple of questions:
Is there a more reliable way to get th...
I was wondering how much memory does an object that inherits from "object" and has no fields/properties take ? And I guess methods don't. Right ? I am talking for .net objects.
...
I have access to a sharepoint list like so:
SPList countries = site.RootWeb.Lists["Countries"];
the list has a CountryCode column and a CountryName column
using linq how can i databind this as a datasource for a drop down
so that the "Value" is "CountryCode" and the "Text" is "CountryName"
...
I have the following situation.
I'm building my application on top of a framework. I can access data only through web-services.
But the framework only contains web-services that return one table per web-service.
In the data-base these tables have relation between them. For export (getting the data out of the database) I could easily me...
What is the correct way to supply WindowsCredentials to the ReportViewer control in order to authenticate to a Report Server?
When browsing to the reports a popup will ask for credentials, but i'm not able to provide the credentials in code? Have tried numerous sollutions on the web, but nothing seems to fit?
...
I have the following code, repeated on each Form, as part of the Update process. When the page loads the BLL returns a DataSet, say
_personInfo = ConnectBLL.BLL.Person.GetPerson(personID);
I store that DataSet in a Form level variable which I then use to check against for changes during the Validate/Update process. I pass a row at ...
hello
i rewrite the message for better understandnig
how can i search for address only using google map api.
if i will search for adderss i dont want google give a bussiness with the same name of the address ( i don't want to get bussiness at all)
thanks for your help.
...
I have an upcoming .NET project that would require conversion from image (bitmap) into .pdf and .eps format. We would prefer to use third party library tool to do this rather than spending the time to reinvent the wheel. Here is the basic requirement:
Preferrably a pure .NET library (we might put this converter code in Silverlight appl...
I am using a .NET FileSystemWatcher on a Windows server to watch a folder on a Windows server.
I also have access to the same folder from a Linux server using Samba.
If I copy a file from the watched folder to somewhere else, a change event is generated for the source file.
Is this behaviour correct? It seems to change the 'last accessed...
I'm trying to dynamically set an enum based on the value in a string so far so good I don't know what I've been doing wrong. I have the following code:
public enum TagLabels : long
{
TurnLeft = 0x0000000000000000000030A38DB1,
TurnRight = 0x00000000000000000000307346CC,
LiftApproach = 0x0000000000000000000012...