Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I cannot seen to find out the purpose of the ^ in a C# method call.
For example:
SomeObject::somemethod(ObjArg^ arg)
{
// method body
}
What is the effect of the ^?
This is not C#. This is C++/CLI. The ^ is the Handle to Object Operator. It is used here to indicate that arg is a handle to a managed class of type ObjArg.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
In php, it is possible to directly call a method on a newly created class instance.
(new MyClass())->classMethod();
Is it possible to do this in C#?
Yes, possible, although I am not sure why you need to do it (it is not recommended).
new MyClass().CallMethod();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have a event whose publish method has a signature as follows:
publish((string moduleName,object moduleData) payload)
I have a set up a mockEventAggregator and other necessary setups but I need to verify if it has been called once.
I am having a tough time trying to write the verify statement as the parameter seems a bit complex and confusing to me on how to implement it, as I'm not able to get the syntax right.
here's what I'm trying:
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>(), Times.Once));
You have wrong brackets. Move one bracket from the end after It.IsAny<(string,object)>()
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>()), Times.Once);
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am trying to replace a string content with another but it does not replace
string oldValue= "iif([PricingTKt_US]>0,1-([F221-B01]/iif([PricingTKt_US]=0,1, [PricingTKt_US])),0)";
oldValue=oldValue.Replace("[PricingTkt_US]","[F123]")
Please help me to understand the mistake I am doing.
string oldValue= "iif([PricingTKt_US]>0,1-([F221-B01]/iif([PricingTKt_US]=0,1, [PricingTKt_US])),0)";
PricingTKt_US Capital K.
oldValue=oldValue.Replace("[PricingTkt_US]","[F123]")
PricingTkt_US Small k
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm currently working on translating a VB.net program to C# and I'm having an issue with the process.
I'm trying to do the following with ConfigurationManager :
string myNumbers = ConfigurationManager.AppSettings("ClientNumbers");
Where ClientNumbers is a list<string> which works in VB.net but presents me with a "Method, delegate or event is expected" error in C#. I'm not sure why that is and I can't seem to find an answer using my Googling skills.
Thanks, in advance, for any assistance.
simply:
string myNumbers = ConfigurationManager.AppSetings["ClientNumber"];
you need to use the C# indexer which is a square bracket.
You misspelled the brackets
ConfigurationManager.AppSettings["ClientNumbers"];
Simply use this link for conversion http://www.developerfusion.com/tools/convert/vb-to-csharp/
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
Need regular expression to validate email address also if user don't have email, user able to type 'No Email'. such that regular expression should validate 'No Email' as a valid string.
#"^(([\w\.\-]+)#([\w\-]+)((\.(\w){2,3})+)|(No Email))$"
You can combine your regex with an or expression |
var regex = "(.+#.+\..+|No Email)"
http://refiddle.com/h2x
The validation part need some improvement (not RFC compliant) but you get the idea.