String.Split is convenient for splitting a string with in multiple part on a delimiter.
How should I go on splitting a string only on the first delimiter. E.g. I've a String
"Time: 10:12:12\r\n"
And I'd want an array looking like
{"Time","10:12:12\r\n"}
...
Is there a way for an app to present the user with the UAC prompt only once, upon first running. Thereafter, no further prompting.
In other words, I understand that our app needs the user's UAC permission to do certain things. And that's fine. But we don't want it to have to keep asking on every occasion it runs. Can the user give permi...
int a, b, c, d, e;
a = b = c = d = e = 1;
if ((a==b) && (b==c) && (c==d) && (d==e))
{
Console.WriteLine("that syntax is horrible");
}
is there a more elegant way to test multiple equality as above?
maybe an AreEqual(params obj[]) or something? I had a google but didn't find anything.
...
Dear ladies and sirs.
I have a stream which contains some XML. The XML may either be encoded using binary XML writer (for instance obtained from XmlDictionaryWriter.CreateBinaryWriter) or non binary XML writer (like as in XmlWriter.Create).
I wish to know which reader to use - the one from XmlDictionaryReader.CreateBinaryReader or the ...
Hi All,
I am using FontDialog control in vb.net application. When I set its ShowColor property to true, it shows me StrikeOut, Underline and Color option under Effects group. I need only color from these three. Is there any way to hide Strikeout and underline effects, so that only Color option will be visible.
Thanks in advance for any k...
My businesslayer\data access library is being used by both a web application and a wcf service. I need to set the current user context on each request for both of these application which would contain userid, Ip, application type etc etc.
The library is obviously not aware what type of application is using it.
Now i cant keep this info...
A while back I wrote an ORM layer for my .net app where all database rows are represented by a subclass of DatabaseRecord. There are a number of methods like Load(), Save() etc. In my initial implementation I created a connection to the DB in the constructor of DatabaseRecord e.g.
connection = new SqlConnection(
ConfigurationManager...
hi guys,
Just wanted to ask to how is User management and Page access based on user role is implemented?
1]Suppose page/feature access is to be given based on type of user eg: Sales,Marketing,Engineering .So we end up with something like
if(CurrentUser.IsInRole("Sales"))
{
//for - sales feature
}
else
{
// etc..etc.. ...
Hi
I like the C# 3 initializer syntax and use it a lot, but today while looking in Reflector, the following came up:
var binding = new WSHttpBinding
{
ReaderQuotas = { MaxArrayLength = 100000 },
MaxReceivedMessageSize = 10485760
};
At first I thought it was a mistake, but it does compile! Guess I am still learning new stuff all t...
Possible Duplicates:
Why doesnt .Net have a Set data structure?
C# Set collection?
Just curious as to why Sets were left out of .NET collections. It seems like a pretty big omission, and I wondered what the reason might be.
BTW I know that there is HashSet in .NET 3.5, but it did take Microsoft a long time to get around to p...
I'm writing a winform's (C# .NET) app to change Window's Global (aka internet explorer's) proxy settings.
I'm using this.
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", "127.0.0.1:8080"...
We have ASP.NET application which runs different clients around the world. In this application we have dictionary for each language. In dictionary we have words in lowercase and sometimes we uppercase it in code for typographic reasons.
var greek= new CultureInfo("el-GR");
string grrr = "Πόλη";
string GRRR = grrr.ToUpper(greek); // "ΠΌΛ...
In an answer to a previous question somebody recommended:
have the SqlConnection a member variable of your class, but make the class IDisposable and dispose of the SqlConnection when the class is disposed
I have put together an implementation of this suggestion (below) but wanted to check that this implementation is correct (obviou...
First of all, this will not be a post about Database Transactions. I want to know more about the TransactionModel in .NET 2.0 and higher. Since I am developing against .NET 3.5 newer models are apprechiated.
Now, what I would like to acheive is something like the following
public void Withdraw(double amount)
{
using (Tr...
Hi
How can I force a shrink of a DataTable and/or List so that I can free memory efficiently? I am currently removing the processed row from the DataSet every iteration of the loop, but I'm not sure if the memory is being released.
for (int i = m_TotalNumberOfLocalRows - 1; i >= 0; i--)
{
dr = dt.Rows[i];
// Do stuff
dt.Rows.R...
My Code something like this
try
{
using (TransactionScope iScope = new TransactionScope())
{
try
{
isInsertSuccess = InsertProfile(account);
}
catch (Exception ex)
{
...
What tools exist in Java that are equivalent to svcutil.exe for .NET?
...
So I am trying to simply decorate a class to serialize it as XML. Here's an example of my problem.
[XmlElement("Dest")]
public XmlNode NewValue { get; set; }
The real problem here is that sometimes in this implementation the XmlNode can be an XmlElement or XmlAttribute. when it's an element this code works fine, but when it comes ...
I have a personal project written in VB10, and am publishing it from VS2010. However, when users attempt to run the created setup.exe, they receive an error stating .net 4.0 is required. At first I assumed I had simply not set the framework as a prerequisite, but I do have "Microsoft .NET Framework 4 (x86 and x64)" checked as one of the ...
The process of converting from Visual Studio .NET 2003 to Visual Studio 2008 is satisfyingly start forward.
I thought it would be worth asking a couple of questions though:
1) Are there any 'gotchas' with this conversion process that we should be aware of?
2) Same question goes for upgrading the .NET Framework from 1.1 to 3.5?
Thanks...