Operators.ConcatenateObject()
Looking for a replacement for the method. i c#
This Method comes from vb
https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.compilerservices.operators.concatenateobject?view=net-7.0
But is there something else I can use?
Operators.ConcatenateObject(Object, Object) Method (Microsoft.Visua...
Represents the Visual Basic concatenation (&) operator.
34 Replies
Why do you want to concatenate objects? That makes little sense
Then they want to concat strings, you're right. For objects it would only make sense in a language like JavaScript where doing so would concat 2 associative arrays
Yuck, that does a whole lot of magic: https://source.dot.net/#Microsoft.VisualBasic.Core/Microsoft/VisualBasic/CompilerServices/Operators.vb,106937ece6ff6502
Oh man, framework source is damn ugly in VB
Hi,
Got an old project in my lap at work that my boss wants me to rebuild with newer technology. He means write it in csharp and not in vb haha.
I want to Check lastActivity folder and file name
trying to convert this to c# 🙂
Set oFiles = oFolder.Files =
LastActivity = Operators.ConcatenateObject("file", File);
But then I need to install And I do not what to do that
Can I write it like this?
how should last activity look like?
"report" and the file name or the complete file path?
Just the report and the filename.
I have the filepath
It is a automating file archive system.
It looks for three folders and looks for files that are 1 hour and moves the files to a other folder like a Archive.
here a little code snipped how it could work... (not tested)
Nice, Looks like the one I am write right now but yours was so much better 🙂
Thank you for you help.
no problem
in C# there is also a lot of code sugar
Shouldn't you be using
Path.Combind
instead of interpolation? Or is "report" part of the filename?As I see it the variable LastActivity is only used to display the current process and is not used for file processing.
Otherwise you are right, Path.Join or Path.Combine would be the right choice.
OK
This is my result
How come my code snippes do not look like yours @dancepanda42 ?
There are many ways that lead to the target.
You can omit the query because of the filter in .
What is the variable
LastActivity
needed for anyway?
behind the three "`" comes a csharpIts for the writing in the logging file later in the code.
it needs a new line after csharp
Nice
So do you code for a living or for hobbies?
living
but starts with hobby
for the
Log
variable I would recommend a StringBuilder. This is not as computationally intensive as an extension of a string.Same.
Okej Thanks for the tips.
Started working about 1 year ago.
But man o man a lot more to learn haha
or just use the File.AppendAllText method instead of the Log variable
Okej will try that 🙂 Thank you for taking your time helping me 🙂
This bit is little wired.
What will happen if I write
I do not know that its for
You shouldn't need a
FileSystemObject
. It looks like you only use it to get a directory, which can be done in a better way
You already use Directory.GetFiles
to get the files in a directory, what else am I missing the oFso does?Yes I do not need LastActivity,
What I was trying to do is Finding folder then files in folder but do not need LastActivity Yes thats true. In the old code oFso is use to GetExtenstionName(FilePath) But I am getting that from Directory
What I was trying to do is Finding folder then files in folder but do not need LastActivity Yes thats true. In the old code oFso is use to GetExtenstionName(FilePath) But I am getting that from Directory
You won't and shouldn't normally need to use reflection, i.e. CreateInstance
Funny thing is that when I got the assignment I found Telerik code converter so I thought that this will be a easy task haha
Code converters are always dodgy
Yes they are. Had some help but you two had helped me a lot to day. I appreciate that 🙂
And been writing all day and I am so happy that I order and got my new mouse and keyboard last week
My mommy always told me that a good programmer has Logi hahah