Validating C# base class constructor parameter

After running Code Analysis in VS2010 beta (FxCop for previous versions) I’m getting the following warning: In externally visible method ‘Identity.Identity(WindowsIdentity)’, validate parameter ‘windowsIdentity’ before using it. The constructor is: public Identity(WindowsIdentity windowsIdentity) : base(windowsIdentity.Token) { init(); } for a class defined as: public class Identity : WindowsIdentity My question is, how do I validate … Read more

What is the @ Sign in front of parameters [duplicate]

This question already has answers here: Closed 11 years ago. Possible Duplicate: What does the @ symbol before a variable name mean in C#? I have been coding in C# for about a year now, and recently i came across the following public bool OnPreUpdate(PreUpdateEvent @event) As you can see event has an ‘@’ sign … Read more

How to create IN OUT or OUT parameters in Java

In PL/SQL (or many other languages), I can have IN OUT or OUT parameters, which are returned from a procedure. How can I achieve a similar thing in Java? I know this trick: public void method(String in, String[] inOut, String[] inOut2) { inOut[0] = in; } Where the in parameter represents an IN parameter and … Read more

Access public static final string in mybatis sql in mapper files

I have a sql written in a MyBatis mapper file which is something like this: <select id=”somesql”> select a,b,c from tbl_name where d = ? </select> The placeholder value for d is supposed to be a constant declared in a file called Constants.java as: public static final String d = “d_value”; How do I replace … Read more

.Net Core 3.1 adding additional config.json file to configuration argument in Startup

I need to add another configuration file to my .Net Core Blazor project. Other sources (such as this) mention using configuration builder in .Net core 2.2, but since in 3.1 the configuration is passed as a parameter into Startup, I have no way of appending another config onto it as far as I can tell. … Read more

Should we allow null/empty parameters?

I recently had a discussion with a co-worker on whether we should allow null or empty collections to be passed as method parameters. My feeling is that this should cause an exception, as it breaks the method’s ‘contract’, even if it does not necessarily break the execution of the method. This also has the advantage … Read more

Iterating through method parameters

It’s a simple and maybe trivial question: in Java how can I iterate through the parameters passed to the method where I’m working? I need it to trim() all of them that are strings. EDIT To be more precise an example of use can be this (written in a pseudo-code reflecting how I wish it … Read more

when do we need to pass the size of array as a parameter

I am a little bit confused about pass an array in C/C++. I saw some cases in which the signature is like this void f(int arr[]) some is like this void f(int arr[], int size) Could anybody elaborate what’s the difference and when and how to use it? Answer First, an array passed to a … Read more