Hi. I want to generate an XML like this:
<a:foo>
<b:bar><b:value="test" /></b:bar>
</a:foo>
I'm generating an XML from a class descriptor. I have this:
[Serializable]
[XmlType(Namespace = Constants.NS_A)]
[XmlRoot("Foo", Namespace = Constants.NS_A, IsNullable = false)]
public class Foo
{
private Bar_ bar = new Bar_();
[XmlEl...
This image shows fragmentation in my app's address space. Is there any way to force the (third-party) dll images (purple) together to eliminate (or mitigate) the fragmentation?
This app will run on 32-bit XP; obviously when we eventually move to 64-bit Windows 7, this problem will go away.
Thanks!
...
I'm looking for suggestions as to what type of form control, or what combination of form controls I should use for the following task:
I have a list of files that all need to be renamed, and the new name must be typed in manually. I essentially need to display the list of files, and provide a text box for renaming. I prefer that all f...
This is the function that I use in web service for getting current windows user.
<WebMethod()> _
Function User() As String
Dim p() As String = Split(My.User.Name, "\")
Dim p1 As String = p(1)
Return p1
End Function
When I run service on localhost it realy return current windows user name!
The problem is ...
I have an XSD file and I want to create an XML file at runtime based on the XSD. (My question is basically the same as this one, except in the .NET world, rather than for Java.)
I have run xsd.exe /c /l:vb MyTest.xsd, but that generates a class that cannot be instantiated and used, as it has nested classes that are never instantiated. ...
I'm using JSON.NET to serialize and deserialize object for different purposes. I'm a big fan of DI but the code below gives me the chills. Is smells like bad code:
public class Foo : Baz
{
private readonly IBar bar;
public Foo()
: this(ObjectFactory.GetInstance<IBar>())
{ }
public Foo(IBar bar)
{
if ...
Hi,
I'm trying to throw my own custom exception inside a FaultException from my WCF service and catch it in my WCF client. On the client side, however, the exception is caught as a non-generic FaultException and the details of my custom exception are lost.
My custom exception is:
[Serializable] public class MyCustomException : Applic...
I have used CLR stores procedures in SQL server for awhile now, but I'm still wondering what the best situations to use them are.
MSDN provides some guidelines for use like heavy string manipulation (regex), or replacing T-SQL that declares lots of table variables and cursors. I'm curious to know what problems SO users are solving with...
I'm on an ASP.Net 2.0 project, in C#. I have some data that gets stored in session state. For ease of use, it is wrapped in a property, like this:
protected IList<Stuff> RelevantSessionData
{
get
{
return (IList<Stuff>) Session["relevant_key"];
}
set
{
Session["relevant_key"] = value;
}
}
Gettin...
I have this code setup currently:
TreeView tree;
TreeNodeBinding treeNodeBinding = new TreeNodeBinding();
treeNodeBinding.TextField = "Name";
treeNodeBinding.DataMember = "Address";
treeNodeBinding.ValueField = "Zip";
treeNodeBinding.ToolTipField = "FileName1";
tree.DataBindings.Add(treeNodeBinding);
tree.DataSourceID = "Customers";
tr...
I'm using a DataGridView with C#.NET. When a user is editing a column, I need another column in the same grid to change with every keystroke/change. How/where do I insert my own code for this type of event?
...
We are having a windows aplication(WPF .net 3.5) that client will be installing using ClickOne full trust.
At first startup user enters credential which are being used to communicate with server.
I need to persist those credential some where in windows app so it would be used by application to function.
Where and how could i save it?
...
I just downloaded the DotNetOpenAuth library and ran the AuthConsumer demo. It is an excellent library so far! Everything worked as advertised, which has not been my experience with a lot of Facebook and Twitter sample code that I have been working with recently.
What I am trying to figure out is: How do I tweet using this library? I ...
I have two tables, Reports and Visualizations. Reports has a field, VisualizationID, which points to Visualization's field of the same name via a foreign key. It also has a unique key declared on the field. VisualizationID is not nullable. This means the relationship has to be 0..1 to 1, because every Reports record must have a unique, n...
In Model-View-Presenter what is the correct pattern to do a page that:
a) contains a grid for browsing a list of items
b) an alternate mode for editing single items
maybe you are toggling between two asp:panels.
Do you just make the presenter smart enough to do two types of presentations?
Make 2 presenters?
I'm new to this pattern ...
Given the following two cases, which one is preferable (If they're both bad, doing it a completely different way is an option too)?
Convert.ToInt32 called in Where:
var items = GetItems();
if (aDropDownList.SelectedIndex > 0)
{
items = items.Where(x =>
x.IntProperty == Convert.ToInt32(aDropDownList.SelectedValue)...
In our project, we have about 70 C# Projects. We need to deploy the components to development server. I'm wondering if there is any standalone tool which aids this process, rather than building each project one by one, or creating a VS Solution containing all the projects.
What I'm picturing is a simple application where I enter the .cs...
I'm probably doing this the hard way, so what's the cleanest way to convert from a percentage to a string containing one part of an RGB hex value?
This is what I've got:
//dealing with small percentages, need to magnify the color differences.
double increaseVisibilityFactor = 5;
double percent = someDouble / someOtherDouble;
doub...
If I have a decimal, how do I get a string version of it with two decimal places? This isn't working:
Math.Round(myDecimal, 2).ToString("{0.00}");
...
I'm developing a line-of-business application using WPF, possibly multitargeting SL as well. One of the requirements is that UIs be composed based on user roles/rights. For example, if the user is a salesperson, she shouldn't see any of the accounting components. If the user is an accounting clerk, that user will see some accounting comp...