The DLL is not running on the server, it is running on the client. I apparently forgot to add that part.
"Programming is like sex, one mistake and you have to support it forever."
John
johnmc@mvmills.com
I am creating a C# dll for use on our intranet, so there are some security issues. I have given the web unrestricted File IO permissions. This function works fine:
[FileIOPermission(SecurityAction.Assert, Unrestricted = true)]
protected void LoadIt (string path)
{
XmlDocument doc = new...
The two options that I can think of for what you have described are:
1. Create one class with several static functions (one for each class of access), then pass variables to that function to determine eactly what to do.
2. Use a static member variable (Singleton like you suggested) to hold...
An interface is a contract with the compiler that your objects (not your Types!) will be able to handle a function call through that interface. A static method is called with a Type, not an object, and you cannot get an interface handle on a Type. Basically, what you claim you want is not...
The Value property returns an object, and that object might not actually be an int. Convert.To*() will take an object, cast it to an IConvertible, and then call its To* function. So basically Convert does the cast by asking the object to please cast itself.
"Programming is like sex, one...
Try passing your value to Convert.ToInt32(), a cast may not always work the way you think it should.
"Programming is like sex, one mistake and you have to support it forever."
John
johnmc@mvmills.com
Thanks Cheiron, that is exactly what I was looking for, and although it isn't as elegant as having the compiler handle it for you (which pretty much any language but C is all about), it still achieves the desired result.
Unfortunately I decided to change the names of the functions in my...
Not to step on your toes obislavu, but C# doesn't work that way. It is much more like Java than C++ in terms of passing variables to functions.
In C# their are two types of types, object (reference, etc) types (string, DataTable, etc) and value types (int, float, any struct, etc). When an...
The following function should do what you would like in a very generic way:
object StringToEnum (string val) {
int last_dot = val.LastIndexOf('.');
if (last_dot <= 0 || last_dot == val.Length - 1)
throw new ArgumentException("Not a valid enumeration value."...
Yes, it is very possible and in fact not very hard. Once you create your C# project, add your C++ ActiveX code as a reference by right-clicking References, going to the COM tab, and then browsing for your component. This will automagically create an Interop.whatever.dll so that your C# can...
So you want something like:
[] File 1
[] File 2
[] File 3
...
or:
[] Text from file 1 that may go
on for many lines...
[] Text from file 2 that may go
on for many lines...
[] Text from file 3 that may go
on for many lines...
...
If so, this can be done fairly easily, and you don't need to...
I have the following setup:
interface A {
...
}
interface B {
A foo ();
}
class C : A {
...
}
class D : B {
C foo ();
}
So basically, I want class D to return a specific type (C) while at the same time implementing interface B which wants a more general type returned (A). One...
You can also inline your casting like so:
((A) q.pop()).somethingInA();
or you can use Reflection like so:
object obj = q.pop();
obj.getType().InvokeMember("somethingInA", BindingFlags.InvokeMethod, null, obj, null);
but it is slower to use Reflection than casting...
I was also doubtful, as I have never seen a language or compiler support anything like copying an enum. I just did it using the way I did in the first post, but since the enums I wanted to copy only had a few members, it wasn't bad.
"Programming is like sex, one mistake and you have to...
Does anyone know if there is an easy way to copy an enum? I know [ok, think] I could do something like:
enum MyEnum {
One = TheirEnum.One,
Two = TheirEnum.Two,
Three = TheirEnum.Three,
...
}
but I am wondering if a better way exists?
"Programming is like sex, one mistake and...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.