question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class and Namespace Name Collision

See original GitHub issue

Main class and namespace in which it is declared share the same name.

namespace Spectrogram
{
    public class Spectrogram
    {
...

This causes some inconvenience when creating an instance.

using Spectrogram;

var spec = new Spectrogram(...);
// CS0118: 'Spectrogram' is a namespace but is used like a type

I know this is a breaking change, but have you considered changing the namespace’s name?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
swhardencommented, Jan 4, 2021

Thanks again for raising this issue @lawrence-laz! I ended-up changing it to SpectrogramGenerator, updated all the documentation, and released version 1.3.0 on NuGet 👍

1reaction
swhardencommented, Dec 23, 2020

name SGram however strikes as a bit odd and cryptic

name SpectrogramGenerator seemed a bit better

I think I agree with you here!

// this is shorter, but cryptic
var sg = new SGram(sampleRate, fftSize: 4096, stepSize: 500, maxFreq: 3000);
sg.Add(myData);
sg.SaveImage("data.png");
// this is more to type, but more expressive
var sg = new SpectrogramGenerator(sampleRate, fftSize: 4096, stepSize: 500, maxFreq: 3000);
sg.Add(myData);
sg.SaveImage("data.png");

Expressiveness and readability should be favored over character count…

I’ll sleep on this one for a day or two and come back with fresh eyes before I make a final call! Thanks again for pointing it out @lawrence-laz. I’ll leave this issue open until I fix it and the new package is in NuGet

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Namespace & Class name collide
Resource = Rsrc; ? This may help avoid name collision. I'm curious if that would work - but not sure (hence not posting...
Read more >
c# - Avoiding conflicting namespace and class name
If you choose some appropriate name, all conflicts can be avoided by the client of your classes, by simply using the full qualified...
Read more >
2.9 — Naming collisions and an introduction to namespaces
This error is generally referred to as a naming collision (or naming conflict). If the colliding identifiers are introduced into the same file, ......
Read more >
How to avoid name collisions in C ++ class names
I myself use a unique method for class names. The ultimate solution is to use namespaces, Namespaces are not available in Unreal C...
Read more >
C# namespace class name conflicts
I recently ran into the following question in the c# challenge mode: "The class names declared in one namespace may conflict with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found