|
There are some funny restrictions so I guess I should list them.. for completeness and all
Methods are not inlined if (but not only if):
- it takes an argument which is a struct (build-in ValuesTypes such as Int32 do not count)
- it contains any exceptions handling (throwing is OK though)
- it is virtual (even if sealed - future versions may fix)
- it contains control flow less simple than a single if/else (for/while/do/switch/multiple if's)
- it is bigger than 32 bytes of IL
- random other reasons or a MethodImpl(MethodImplOptions.NoInlining) attribute
Methods are inlined whenever the JIT compiler feels like it and it wouldn't break any of the above rules
All non-static methods in a struct take a struct as implied first argument (this ) and are therefore not considered for inlining (worst restriction, IMO).
Short-circuiting operators and ?: count towards the limit of 1 if .
Method calls are OK
|
|
|
|
|
It will be simple static functions, mostly reading bytes from an array into 12/16/40 bit values so should be fine.
|
|
|
|
|
If you wait a moment you'll get a reply from PIEBALDconsult telling you there is nothing stopping you from using the C/C++ preprocessor as a build step for C# apps.
|
|
|
|
|
Never, ever ask about dates whilst he's online - everyone, even end users, should be forced to use ISO 8601 apparently
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
You bet. Well, not forced, per se...
|
|
|
|
|
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Sorry, I was out. Thanks for filling in.
|
|
|
|
|
You're welcome back.
|
|
|
|
|
I have an application that uses the Enterprise Application Block 3.1. Yes I know there is an Enterprise Application Block 4.0 and 5.0 that is now available. I cannot use these applications blocks because they require the 3.5 .NET Framework. Anyway, I know that the Enterprise Application Block 3.1 uses the DbConnection class and I am curious as to which databases this supports? I could not find this anywhere in MSDN. I think some database connections require custom classes that derive from the DbConnection class but I am after a list of databases that the Enterprise Application Block 3.1 will automatically handle without the implementation of custom classes?
Chris
|
|
|
|
|
Ummm... any class that derives from DbConnection? That's the point of interfaces and abstract classes.
By using System.Data.IDbConnection and System.Data.IDbCommand my primary database class supports:
public enum SupportedDatabase
{
Access
,
Cache
,
Excel
,
FireBird
,
Ingres
,
MySql
,
ODBC
,
Oracle
,
SqlServer
,
OleSqlServer
}
And I'll add more as I find them.
|
|
|
|
|
Thanks for the response. I am so glad someone else is using this besides me. I do have another question. With the databases that you mention, none of them require attaching addition dlls? For example, MySql doesn't require you to install some sort of .NET Component Installation and then attach those .NET DLLs to your solution so a user can then use MySql? Or is that automatically included within the enterprise library like SqlServer? What about Cache?
Chris
|
|
|
|
|
Unless it uses the OleDb provider, each database needs its own provider -- but the "install" is just a copy of the DLL:
Ca.Ingres.Client.dll
FirebirdSql.Data.FirebirdClient.dll
InterSystems.Data.CacheClient.dll
MySql.Data.dll
Oracle.DataAccess.dll
|
|
|
|
|
Hi,
I want to download files Asynchronously from internet in my C# application.
I don't have any idea about Asynchronous downloading.
Can any one help me???
Thanks,
Sunil G.
modified on Saturday, April 10, 2010 4:27 PM
|
|
|
|
|
Try the WebClient class...
Chris
|
|
|
|
|
There's an example here[^]. Good luck
I are Troll
|
|
|
|
|
Hi,
I want to download 10 mb file from URL or FTP. downloading is in progress and 5MB downloaded, now i want to cancel the download. Next time the application should download remaining 5 MB.
How to do it?
Reply ASAP.
Thanking You,
Sunil G.
|
|
|
|
|
Sunil G wrote: How to do it?
Using BITS[^]. Divide the data over two zipfiles and download them.
Sunil G wrote: Reply ASAP.
Whehe, you failed to specify in which year I should reply - so I assumed "this" year
I are Troll
|
|
|
|
|
RegEdit Copy Key Name for Microsoft Office 10.0 is "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0". So why is registry equal to null in "registry = Registry.LocalMachine.OpenSubKey( @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0", false);" in the following C# 2008 code?
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace MSKeyFinder
{
public partial class frmMain : Form
{
private const int CS_DROPSHADOW = 0x00020000;
public frmMain()
{
InitializeComponent();
}
protected override CreateParams CreateParams
{
get
{
CreateParams p = base.CreateParams;
p.ClassStyle |= CS_DROPSHADOW;
return p;
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
byte[] digitalProductId = null;
RegistryKey registry = null;
try
{
registry = Registry.LocalMachine.OpenSubKey(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0", false);
}
catch (System.Exception ex)
{
string caption = "Error";
MessageBoxButtons buttons = MessageBoxButtons.OK;
MessageBoxIcon icon = MessageBoxIcon.Error;
MessageBox.Show(ex.Message, caption, buttons, icon);
Environment.Exit(0);
}
finally
{
if (registry == null)
{
string message = "Microsoft Office (TM) XP not installed or error\r\n" +
"reading Registry (Registry.LocalMachine.OpenSubKey returned null).";
string caption = "Error";
MessageBoxButtons buttons = MessageBoxButtons.OK;
MessageBoxIcon icon = MessageBoxIcon.Error;
MessageBox.Show(message, caption, buttons, icon);
Environment.Exit(0);
}
else
{
registry.Close();
lblOffVersion.Text = (string)"Microsoft Office (TM) 2002";
digitalProductId = registry.GetValue("DigitalProductID") as byte[];
lblOffiProductKey.Text = (string)DecodeProductKey(digitalProductId);
}
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
About dlgForm1 = new About();
dlgForm1.ShowDialog();
}
public static byte[] GetRegistryDigitalProductID()
{
byte[] digitalProductId = null;
RegistryKey registry = null; ;
try
{
registry = Registry.LocalMachine.OpenSubKey(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Registration\" +
@"{91110409-6000-11D3-8CFE-0050048383C9}", false);
}
catch (System.Exception ex)
{
registry.Close();
string caption = "Error";
MessageBoxButtons buttons = MessageBoxButtons.OK;
MessageBoxIcon icon = MessageBoxIcon.Error;
MessageBox.Show(ex.Message, caption, buttons, icon);
Environment.Exit(0);
}
finally
{
if (registry == null)
{
registry.Close();
string message = "Microsoft Office (TM) XP not installed or error\r\n" +
"reading Registry (Registry.LocalMachine.OpenSubKey returned null).";
string caption = "Error";
MessageBoxButtons buttons = MessageBoxButtons.OK;
MessageBoxIcon icon = MessageBoxIcon.Error;
MessageBox.Show(message, caption, buttons, icon);
Environment.Exit(0);
}
else
{
digitalProductId = registry.GetValue("DigitalProductID") as byte[];
registry.Close();
}
}
return digitalProductId;
}
public static string DecodeProductKey(byte[] digitalProductId)
{
const int keyStartIndex = 52;
const int keyEndIndex = keyStartIndex + 15;
char[] digits = new char[]
{
'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'M', 'P', 'Q', 'R',
'T', 'V', 'W', 'X', 'Y', '2', '3', '4', '6', '7', '8', '9',
};
const int decodeLength = 29;
const int decodeStringLength = 15;
char[] decodedChars = new char[decodeLength];
ArrayList hexPid = new ArrayList();
for (int i = keyStartIndex; i <= keyEndIndex; i++)
{
hexPid.Add(digitalProductId[i]);
}
for (int i = decodeLength - 1; i >= 0; i--)
{
if ((i + 1) % 6 == 0)
{
decodedChars[i] = '-';
}
else
{
int digitMapIndex = 0;
for (int j = decodeStringLength - 1; j >= 0; j--)
{
int byteValue = (digitMapIndex << 8) | (byte)hexPid[j];
hexPid[j] = (byte)(byteValue / 24);
digitMapIndex = byteValue % 24;
decodedChars[i] = digits[digitMapIndex];
}
}
}
return new string(decodedChars);
}
private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = DateTime.Now.ToShortTimeString();
}
}
}
|
|
|
|
|
Closed this question. I figured it out by myself.
|
|
|
|
|
spicture wrote: I figured it out by myself.
So you are also Member 6677969?
Why? So you can vote yourself up?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You can't do that anyway - or at least not from the same IP address
|
|
|
|
|
Member 6677969 wrote: So why is registry equal to null
The method OpenSubKey returns NULL if the operation failed, as stated in the documentation[^]. This is probably a permission-related issue.
Why would that be? Well, simple; the only reason why someone would want to read that key is to use it on another machine.
I are Troll
|
|
|
|
|
hi, regarding to an article I've read, adding Enlist=true parameter to connection string is enough to add that connection to the pool. I've done and didn't get any errors.Is it done now? Have I implemented the pool in the right way? because I didn't realize any difference
|
|
|
|
|
teknolog123 wrote: regarding to an article I've read
Know one knows what article you are talking about - could you post a link please?
|
|
|
|
|
in fact, I didn't mean to ask you to verify the correctness of the article. Instead, is it enough to add Enlist=true pm to implement the pool
|
|
|
|